GeezerVison is showing github.com — fixes #7382 · webpack/webpack@374376d
File tree
Expand file treeCollapse file tree
Open diff view settings
statsCases/runtime-chunk-issue-7382
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/optimize/RuntimeChunkPlugin.js +9-5Lines changed: 9 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -19,11 +19,15 @@ module.exports = class RuntimeChunkPlugin { |
19 | 19 | compilation.hooks.optimizeChunksAdvanced.tap("RuntimeChunkPlugin", () => { |
20 | 20 | for (const entrypoint of compilation.entrypoints.values()) { |
21 | 21 | const chunk = entrypoint.getRuntimeChunk(); |
22 | | - if (chunk.getNumberOfModules() > 0) { |
23 | | - let name = this.options.name; |
24 | | - if (typeof name === "function") { |
25 | | - name = name(entrypoint); |
26 | | - } |
| 22 | + let name = this.options.name; |
| 23 | + if (typeof name === "function") { |
| 24 | + name = name(entrypoint); |
| 25 | + } |
| 26 | + if ( |
| 27 | + chunk.getNumberOfModules() > 0 || |
| 28 | + !chunk.preventIntegration || |
| 29 | + chunk.name !== name |
| 30 | + ) { |
27 | 31 | const newChunk = compilation.addChunk(name); |
28 | 32 | newChunk.preventIntegration = true; |
29 | 33 | entrypoint.unshiftChunk(newChunk); |
|
Collapse file
Copy file name to clipboardExpand all lines: test/__snapshots__/StatsTestCases.test.js.snap +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1973,6 +1973,11 @@ Child manifest is named entry: |
1973 | 1973 | [4] ./f.js 20 bytes {1} [built]" |
1974 | 1974 | `; |
1975 | 1975 |
|
| 1976 | +exports[`StatsTestCases should print correct stats for runtime-chunk-issue-7382 1`] = ` |
| 1977 | +"Entrypoint e1 = runtime.js all.js e1.js |
| 1978 | +Entrypoint e2 = runtime.js all.js e2.js" |
| 1979 | +`; |
| 1980 | + |
1976 | 1981 | exports[`StatsTestCases should print correct stats for runtime-chunk-single 1`] = ` |
1977 | 1982 | "Entrypoint e1 = runtime.js e1.js |
1978 | 1983 | Entrypoint e2 = runtime.js e2.js" |
|
Collapse file
Copy file name to clipboard +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +module.exports = "entry1"; |
Collapse file
Copy file name to clipboard +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +module.exports = "entry2"; |
Collapse file
Copy file name to clipboard +31Lines changed: 31 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +module.exports = { |
| 2 | + mode: "development", |
| 3 | + entry: { |
| 4 | + e1: "./e1", |
| 5 | + e2: "./e2" |
| 6 | + }, |
| 7 | + output: { |
| 8 | + filename: "[name].js" |
| 9 | + }, |
| 10 | + stats: { |
| 11 | + hash: false, |
| 12 | + timings: false, |
| 13 | + builtAt: false, |
| 14 | + assets: false, |
| 15 | + modules: false, |
| 16 | + reasons: true |
| 17 | + }, |
| 18 | + optimization: { |
| 19 | + runtimeChunk: "single", |
| 20 | + splitChunks: { |
| 21 | + cacheGroups: { |
| 22 | + all: { |
| 23 | + test: /./, |
| 24 | + name: "all", |
| 25 | + minSize: 0, |
| 26 | + chunks: "initial" |
| 27 | + } |
| 28 | + } |
| 29 | + } |
| 30 | + } |
| 31 | +}; |