enhanced-require icon indicating copy to clipboard operation
enhanced-require copied to clipboard

If this lib is CURRENTLY UNMAINTAINED, then what I should do to use webpack client side files in node.js?

Open totty90 opened this issue 10 years ago • 9 comments

I have a large app built on webpack and the server side uses that files. How I'm supposed to make them work (in the future) if this project is "CURRENTLY UNMAINTAINED"? I should use another lib or what?

totty90 avatar Feb 23 '15 09:02 totty90

You can compile it with target "node" and run the compiled code.

The project is just currently unmaintained. It planned to get it up to date once I have time to do that.

sokra avatar Feb 23 '15 17:02 sokra

You can compile it with target "node" and run the compiled code.

Ok, I will try but for dev is not optimal, right? I remember the last time it didn't worked well.

The project is just currently unmaintained. It planned to get it up to date once I have time to do that.

If you need help, and if I will have some time in the future, I might help you.

totty90 avatar Feb 23 '15 17:02 totty90

@sokra Are loaders still supposed to implement sync support as well? I've implemented it for the sass-loader, but it makes the code a lot harder to maintain...

jhnns avatar Mar 17 '15 10:03 jhnns

@jhnns I don't have an answer yet. Not sure if enhanced-require or webpack --target node is the best way to run on server...

sokra avatar Mar 20 '15 12:03 sokra

I've tried both and work pretty good.

  • With enhanced-require you need more boilerplate code;
  • With --target node you put the server code in some other folder which might mess with paths;

totty90 avatar Mar 20 '15 12:03 totty90

I'm using https://github.com/istarkov/babel-plugin-webpack-loaders for my development environment, I'm wondering the same things. I'm only using webpack --target node for my production environment.

oliviertassinari avatar Jan 17 '16 21:01 oliviertassinari

Why don't you use webpack --target node in development too?

jhnns avatar Jan 18 '16 11:01 jhnns

Why don't you use webpack --target node in development too?

To begin with the context, I'm working on the server side with React. As far as I have played with webpack --target node, I wasn't satisfied by the time needed to start it. I'm wondering if it's possible to do some hot releading for the server and express, I haven't looked at it. I endup using babel-plugin-webpack-loaders. I also wanted to use babel-plugin-webpack-loaders for the production environment. But I couldn't. The npm install on the server requires too much disk space.

Edit: @jhnns Turns out that webpack --target node with all the production optimization makes the renderToString() of react 34% faster. So that's definitely the right choice for the production env.

oliviertassinari avatar Jan 18 '16 17:01 oliviertassinari

Cool :+1:

jhnns avatar Jan 19 '16 11:01 jhnns