josebalius / react-isomorphic-starter

MIT License
0 stars 1 forks source link

Use Webpack instead of Gulp #2

Open gaearon opened 9 years ago

gaearon commented 9 years ago

Gulp seems like an overkill for this project to me. Webpack can handle CSS (or SCSS) just fine, and you get hot reloading for it for free.

Generally, I find Webpack+Gulp to be a bad combo because they have incompatible models (e.g. you can't express Webpack incremental builds with Gulp).

josebalius commented 9 years ago

@gaearon you are right about SCSS, but there are some tasks like the bower build that I still haven't thought about how to do without gulp (i brought it in from another project).

The gulp bower task uses https://github.com/taptapship/wiredep to figured out the dependency chain, and build the "bower bundle" with the all of the dependencies in order.

I also have the server/api watcher task in there, and I have had some issues using webpack for server side code.

I agree that I should try to get of one or the other just haven't figured out how to accomplish those tasks yet.

gaearon commented 9 years ago

What is the "bower bundle" for? Can NPM + Webpack replace it somehow? I don't think I understand what it does (and why use Bower, too).

josebalius commented 9 years ago

@gaearon Using bower to manage dependencies to other projects like bootstrap (which i include in this repo), could probably just use NPM but i have ran into projects that are only on bower.

What the gulp bower build does is it uses wiredep to get a list of bower dependencies (CSS/JS) in the correct order necessary (manages conflicts for you as well) i then use this list to create a "library" css/js bundle which are then loaded by the page. It has been a neat way to manage dependencies this way, do you recommend something better?

gaearon commented 9 years ago

I see.

My suggestion is to use Webpack and NPM for everything. Having two different package managers and two different build systems is an avoidable complication.

josebalius commented 9 years ago

thanks @gaearon i'll look at ways to use wiredep directly with webpack, which should then remove the need to use gulp for that.

The only other thing left to take away from gulp would be the server management (watch for changes in server files and restart the http server), I have had some issues using webpack for backend code.

gaearon commented 9 years ago

The only other thing left to take away from gulp would be the server management (watch for changes in server files and restart the http server), I have had some issues using webpack for backend code.

Gulp is not really suited for these tasks either IMO. Just use Webpack Node API.

josebalius commented 9 years ago

It would also solve https://github.com/josebalius/react-isomorphic-starter/issues/3 if I could use webpack for the node layer.

mycall commented 8 years ago

Any progress on this? I'm fighting this exact problem on my own project.

josebalius commented 8 years ago

@mycall which part? using webpack for the node layer?