Add a maxSize option for splitChunks

Do you want to request a feature or report a bug?

I’d like to request a feature.

What is the current behavior?

Using optimization.splitChunksin Webpack 4, I can nicely split out common code. However, common chunks like “vendor” can grow to be very large.

What is the expected behavior?

I’d like to be able to specify a maxSize configuration option, which would automatically subdivide files until they are under the max size. For example, I could specify maxSize: 200000 to limit files to 200kb, and if they are larger than that, they will be split into two or more files.

If this is a feature request, what is motivation or use case for changing the behavior?

The motivation is to allow for files to be loaded and parsed in parallel, rather than having to handle a single very large file.

Author: Fantashit

1 thought on “Add a maxSize option for splitChunks

  1. I totally agree – the ability to limit chunk sizes would be a huge help. Using AggressiveSplittingPlugin breaks automatic script tag inserts handled by HTMLWebpackPlugin.

    I’m not sure why others might need this feature but my justification is because sw-precache-webpack-plugin won’t cache files more than 2.1mb.

Comments are closed.