Skip to content

Commit

Permalink
Merge pull request #11602 from webpack/bugfix/shared-runtime-chunk
Browse files Browse the repository at this point in the history
fix crash when using shared with runtimeChunk
  • Loading branch information
sokra committed Oct 8, 2020
2 parents 9c0587e + e7a1870 commit 13e3ca5
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/optimize/RuntimeChunkPlugin.js
Expand Up @@ -25,6 +25,7 @@ class RuntimeChunkPlugin {
compilation.hooks.addEntry.tap(
"RuntimeChunkPlugin",
(_, { name: entryName }) => {
if (entryName === undefined) return;
const data = compilation.entries.get(entryName);
if (!data.options.runtime && !data.options.dependOn) {
// Determine runtime chunk name
Expand Down
@@ -0,0 +1,5 @@
import x from "x";

it("should work", () => {
expect(x).toBe(42);
});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,5 @@
module.exports = {
findBundle: function () {
return ["./runtime.js", "./main.js"];
}
};
@@ -0,0 +1,15 @@
const { ProvideSharedPlugin } = require("../../../../").sharing;
/** @type {import("../../../../").Configuration} */
module.exports = {
output: {
filename: "[name].js"
},
optimization: {
runtimeChunk: "single"
},
plugins: [
new ProvideSharedPlugin({
provides: ["x"]
})
]
};

0 comments on commit 13e3ca5

Please sign in to comment.