Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13334 from webpack/bugfix/depend-on-runtime-async…
…-chunks
- Loading branch information
Showing
8 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("split"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import path from "path"; | ||
import fs from "fs"; | ||
|
||
it("should not have references to chunks of unrelated entrypoints in runtime", () => { | ||
const content = fs.readFileSync( | ||
path.resolve(__dirname, "runtime.js"), | ||
"utf-8" | ||
); | ||
expect(content).not.toContain("other-entry"); | ||
expect(content).not.toContain("split"); | ||
}); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import "./split"; | ||
import("./async"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("split"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
findBundle: function () { | ||
return ["./runtime.js", "./main.js", "./first-entry.js"]; | ||
} | ||
}; |
39 changes: 39 additions & 0 deletions
39
test/configCases/runtime/entries-in-runtime/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** @type {import("../../../../").Configuration} */ | ||
module.exports = { | ||
mode: "production", | ||
entry: { | ||
main: "./main", | ||
"first-entry": { | ||
dependOn: "main", | ||
import: "./index" | ||
}, | ||
"other-entry": { | ||
dependOn: "main", | ||
import: "./other-entry" | ||
} | ||
}, | ||
target: "web", | ||
node: { | ||
__dirname: false, | ||
__filename: false | ||
}, | ||
externalsPresets: { | ||
node: true | ||
}, | ||
output: { | ||
filename: "[name].js" | ||
}, | ||
optimization: { | ||
runtimeChunk: "single", | ||
splitChunks: { | ||
cacheGroups: { | ||
split: { | ||
chunks: "all", | ||
name: "split", | ||
test: /split\.js$/, | ||
enforce: true | ||
} | ||
} | ||
} | ||
} | ||
}; |