Create-react-app: Evaluate hard-source Webpack plugin

Created on 9 Sep 2016  路  16Comments  路  Source: facebook/create-react-app

https://github.com/mzgoddard/hard-source-webpack-plugin

Still early but very promising. Caches intermediate build steps. Can dramatically speed up incremental builds both for dev and prod.

proposal

All 16 comments

Phenomic implemented it here https://github.com/MoOx/phenomic/pull/646

Just curious: What's the difference between hard-source-plugin and DllPlugin?

ps: here's some articles related to DLLPlugin in case you don't know:

https://robertknight.github.io/posts/webpack-dll-plugins/
https://medium.com/@soederpop/webpack-plugins-been-we-been-keepin-on-the-dll-cdfdd6cb8cd7#.d1g27iray
http://engineering.invisionapp.com/post/optimizing-webpack/

@zhaoshengjun the DLLPlugin speeds up Webpack by making it do less work as you tell it to not pay attention to a list of modules. hard-source-plugin speeds up Webpack by caching incremental work so again Webpack does less but this time by avoiding repeating work that's already been done.

How do we know when/if it becomes stable? I don鈥檛 understand how to evaluate it.

I haven't tried it yet myself so can't comment on its stability but the first thing to do I'd think is try adding it to a create-react-app and see the performance difference to see if that's significant enough to worry about making the change.

I'll be trying it in Gatsby soon. From @thangngoc89 and @MoOx's experiments in Phenomic, it seems quite usable.

Fun you mention us, we just released yesterday a new Phenomic release, which makes available the new "cache" option based on this plugin, that works for both webpack 1 & 2.

Here are some number in a picture

@MoOx Would you like to submit a PR to CRA enabling it?

Hmm, I don鈥檛 think it鈥檚 mature enough. We shouldn鈥檛 leave people with issues like https://github.com/mzgoddard/hard-source-webpack-plugin/issues/31 after ejecting. Let鈥檚 wait more.

I was about to tell you this :)

I opened https://github.com/mzgoddard/hard-source-webpack-plugin/issues/40 so we can track "maturity" :)

To be fair, regardless of the version number, I won鈥檛 feel good using this until major issues are solved. We are also conservative about updates and lock package versions so that CRA itself is less fragile when possible.

I totally understand and I don't think "just bumping" will magically make this "mature".
I think changing the version number won't be done until current major issues are solved, even if I didn't explicitly talk about that ^^.

Consider using happypack as an alternate?
it has caching and does threading too. I have implemented both happy loader(for build process) and webpack hard source(for dev process) in my fork. the speed gains are really good.

happypack doesn't work with [email protected] and has issues with Windows.

Closing, as both suggestions appear to be flaky for some users.
I don't think this is a promising direction unless Webpack core officially embraces it.
(I do think, however, that aggressive caching is essential, and Webpack could do better there.)

cc @sokra @thelarkinn

Sure vote for it: https://webpack.js.org/vote/

@sokra spent 30 influences for it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dualcnhq picture dualcnhq  路  3Comments

Evan-GK picture Evan-GK  路  3Comments

fson picture fson  路  3Comments

stopachka picture stopachka  路  3Comments

fson picture fson  路  3Comments