GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fixes #7382 · webpack/webpack@374376d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/optimize
    • RuntimeChunkPlugin.js
  • test
    • __snapshots__
      • StatsTestCases.test.js.snap
    • statsCases/runtime-chunk-issue-7382
      • e1.js
      • e2.js
      • webpack.config.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/optimize/RuntimeChunkPlugin.js‎

Copy file name to clipboardExpand all lines: lib/optimize/RuntimeChunkPlugin.js
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ module.exports = class RuntimeChunkPlugin {
1919
compilation.hooks.optimizeChunksAdvanced.tap("RuntimeChunkPlugin", () => {
2020
for (const entrypoint of compilation.entrypoints.values()) {
2121
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+
) {
2731
const newChunk = compilation.addChunk(name);
2832
newChunk.preventIntegration = true;
2933
entrypoint.unshiftChunk(newChunk);
Collapse file

‎test/__snapshots__/StatsTestCases.test.js.snap‎

Copy file name to clipboardExpand all lines: test/__snapshots__/StatsTestCases.test.js.snap
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,6 +1973,11 @@ Child manifest is named entry:
19731973
[4] ./f.js 20 bytes {1} [built]"
19741974
`;
19751975

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+
19761981
exports[`StatsTestCases should print correct stats for runtime-chunk-single 1`] = `
19771982
"Entrypoint e1 = runtime.js e1.js
19781983
Entrypoint e2 = runtime.js e2.js"
Collapse file

‎test/statsCases/runtime-chunk-issue-7382/e1.js‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "entry1";
Collapse file

‎test/statsCases/runtime-chunk-issue-7382/e2.js‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "entry2";
Collapse file

‎test/statsCases/runtime-chunk-issue-7382/webpack.config.js‎

Copy file name to clipboard
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
};

0 commit comments

Comments
0 (0)
You are visitor 01402605 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.