Nika Kurashvili
Nika Kurashvili

Reputation: 6474

webpack splitchunksplugin minsize not working

This is my app.js

import Test from './test1'

This is my test1

import('smallest') var a = 10; export default a;

I am not using splitchunksplugin because even if we don't use it, it has some default settings. This is the first 2 default conditions.

I am wondering why it created another chunk for smallest library(this library is less than 30kb before min+gz). Any idea?

Upvotes: 0

Views: 1039

Answers (1)

Airas Yaqub
Airas Yaqub

Reputation: 87

When ever webpack encounters dynamic import statement it will always split it out of main chunk. This way you will have entry-points chunk and async split-points chunk ( in case of dynamic import in your code ). The splitchunksplugin is then used to further optimize/split those chunks and all the default conditions applies there. You can further look into the docs https://webpack.js.org/guides/code-splitting/#dynamic-imports

Upvotes: 1

Related Questions