Initial vendor chunks not respecting minSize
See original GitHub issueBug report
What is the current behavior?
Changing minSIze to 520KB generates synchronous ( initial ) vendor chunk of size 517KB.
If the current behavior is a bug, please provide the steps to reproduce.
I have two entry points with async/sync modules.
// a.js
import { run } from "./app/app";
import ("lodash");
import "bootstrap";
import "./main.scss";
import { AlertService } from "./app/alert.service";
import { ComponentService } from "./app/component.service";
const alertService = new AlertService();
const componentService = new ComponentService();
run(alertService, componentService);
// b.js
import { run } from "./app/app";
import ("lodash");
import ("bootstrap");
import "./main.scss";
import { AlertService } from "./app/alert.service";
import { ComponentService } from "./app/component.service";
const alertService = new AlertService();
const componentService = new ComponentService();
run(alertService, componentService);
The optimization plugin config without custom minSize is as follows where everything generated as expected
optimization: {
minimize: false,
splitChunks: {
chunks: "initial",
// minSize: 520000,
}
}
generated chunks with above config
4.0430a28c67c95515623d.bundle.js 509 KiB 4 [emitted] [immutable] [big]
5.177897857c70dc7eaa96.bundle.js 531 KiB 5, 6 [emitted] [immutable] [big]
6.507730afe61b6ceecf70.bundle.js 531 KiB 6 [emitted] [immutable] [big]
a.ac0e9c622ffd0aace615.bundle.js 10.2 KiB 1 [emitted] [immutable] a
a~b.1fafc50267cf2e753b51.bundle.js 148 KiB 0 [emitted] [immutable] a~b
b.b9218b218e06859b7b0d.bundle.js 18.5 KiB 2 [emitted] [immutable] b
imgs/webpack.523e1b932381f19b26060571ccfc7a31.svg 2.29 KiB [emitted] [immutable]
index.html 1.77 KiB [emitted]
vendors~a.50adedf6af3fbeb56ed3.bundle.js 517 KiB 3, 4 [emitted] [immutable] [big] vendors~a
If uncommented minSize from above config following is the generated output
3.4fe397947d6a74a38870.bundle.js 509 KiB 3 [emitted] [immutable] [big]
4.5289e4657b1f86d851f1.bundle.js 531 KiB 4, 5 [emitted] [immutable] [big]
5.ad452c25e6aa46a1cdff.bundle.js 531 KiB 5 [emitted] [immutable] [big]
a.974925a2f0898c477b9e.bundle.js 158 KiB 0 [emitted] [immutable] a
b.2cd9e2bdb8245dd78851.bundle.js 165 KiB 1 [emitted] [immutable] b
imgs/webpack.523e1b932381f19b26060571ccfc7a31.svg 2.29 KiB [emitted] [immutable]
index.html 1.72 KiB [emitted]
vendors~a.e51176a01049374bf6f1.bundle.js 517 KiB 2, 3 [emitted] [immutable] [big] vendors~a
Note that a.bundle.js and b.bundle.js is increased as main.scss is not spitted out to separate chunk due to minSIze restriction. But its still creating vendor~a chunk even tho its size is 517kb.
If we set minSize to significantly increased number i.e 999999999 we get the expected output with no initial chunks
2.4d4ab8a0eebe11a6149c.bundle.js 509 KiB 2 [emitted] [immutable] [big]
3.434ee8f39d57e8f7dee7.bundle.js 531 KiB 3, 4 [emitted] [immutable] [big]
4.d890b35757aa13206d0e.bundle.js 531 KiB 4 [emitted] [immutable] [big]
a.16d5f9d877a088513a7d.bundle.js 674 KiB 0, 2 [emitted] [immutable] [big] a
b.062bc745c5f2e5e55948.bundle.js 165 KiB 1 [emitted] [immutable] b
imgs/webpack.523e1b932381f19b26060571ccfc7a31.svg 2.29 KiB [emitted] [immutable]
index.html 1.66 KiB [emitted]
What is the expected behavior? When setting minSize to 520kb vendor~a chunk should not be generated as happening with main.scss, respecting minSize.
Other relevant information: webpack version: 4.44.2 Node.js version: 12.19.0 Operating System: ubuntu budgie Additional tools:
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (6 by maintainers)
Thanks. I found the problem. It’s a bug in webpack.
Probably today