Webpack Maximum Package Size

My current configuration is 1 bundle.js file with the main material that the application requires (angular, etc.), and all other lazy ones are loaded through require.ensure into the application code.

After minimizing bundle.js, it is above 100 KB with the base for the application. Is it possible to tell webpack to split the main package into max. 20 KB or so that the browser can download them at the same time?

+5
source share
2 answers

I have not found a good way to split the pieces based on the result of the package itself. You can set a minimum size for output blocks so that they are concatenated when there are not many bytes in your block.

// This plugin prevents Webpack from creating chunks // that would be too small to be worth loading separately new webpack.optimize.MinChunkSizePlugin({ minChunkSize: 51200, // ~50kb }), 

But I know that is not what you are looking for. Unfortunately, no one seems to have written anything like this. Sounds like an interesting recording plugin !

Also, check out this blog post that looks at some basics of splitting. http://blog.madewithlove.be/post/webpack-your-bags/

0
source

This is possible using the "AggressiveSplittingPlugin". You can find it here: https://github.com/webpack/webpack/tree/master/examples/http2-aggressive-splitting

Please note that this plugin is only available if you are using webpack 2.

0
source

Source: https://habr.com/ru/post/1235562/


All Articles