How to improve webpack build speed

1. In the case of multiple entrances, use CommonsChunkPlugin to extract public code

2. Extract common libraries through externals configuration

3. Use DllPlugin and DllReferencePlugin to precompile resource modules. Use DllPlugin to precompile those npm packages that we reference but will never modify, and then load the precompiled modules through DllReferencePlugin.

4. Use Happypack to achieve multi-threaded accelerated compilation

5. Use webpack-uglify-parallel to improve the compression speed of uglifyPlugin. In principle, webpack-uglify-parallel uses multi-core parallel compression to improve compression speed.

6. Use Tree-shaking and Scope Hoisting to eliminate redundant code
 

Guess you like

Origin blog.csdn.net/2302_77913771/article/details/134925200