Speed optimization of Web pack construction
Conventional optimization methods
Separation of base scripts
webpack.DllPluginOptimizing, in fact, does not optimize the speed, but to build some parts that do not need to change frequently in advance, and then only need to build the parts that change, it really optimizes the time.
- Using external, not building basic scripts, and introducing external scripts does reduce time.
- Loader Multiprocess, happypack. According to the test, it hasn’t improved the speed. Maybe webpack 4.0 has used Multiprocess.
- Compressing multiple processes,
parallel: trueA slight increase in speed
- Loader’s cache opens, the first time there will be no promotion, and then the promotion is huge, must be opened, strongly recommended
HardSourceWebpackPluginOn top of cache, there are still tremendous improvements. I strongly recommend that
In summary, caching and stripping the underlying code are two major strategies for optimization, and the multi-process strategy should play a weaker and weaker role in subsequent web pack versions.
Web pack is still too annoying and there are still many configurations. Does front-end engineering have to rely on Web pack?