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 #7062 from webpack/bugfix/issue-6931
fix bug which prevented some chunks to show up in Chunk.getAllAsyncChunks
- Loading branch information
Showing
6 changed files
with
55 additions
and
4 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,17 @@ | ||
const should = require("should"); | ||
const FakeDocument = require("../../../helpers/FakeDocument"); | ||
|
||
beforeEach(() => { | ||
global.document = new FakeDocument(); | ||
}); | ||
|
||
afterEach(() => { | ||
delete global.document; | ||
}) | ||
|
||
it("should be able to load the split chunk on demand", () => { | ||
const promise = import(/* webpackChunkName: "shared" */ "./shared"); | ||
|
||
const script = document.head._children[0]; | ||
should(script.src).be.eql("dep~b~shared.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 @@ | ||
import "./shared"; |
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,5 @@ | ||
module.exports = { | ||
findBundle: function(i, options) { | ||
return ["runtime.js", "a.js"]; | ||
} | ||
}; |
24 changes: 24 additions & 0 deletions
24
test/configCases/split-chunks/runtime-chunk/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,24 @@ | ||
const path = require("path"); | ||
|
||
module.exports = { | ||
entry: { | ||
a: "./a", | ||
b: "./b" | ||
}, | ||
target: "web", | ||
output: { | ||
filename: "[name].js" | ||
}, | ||
optimization: { | ||
runtimeChunk: "single", | ||
splitChunks: { | ||
cacheGroups: { | ||
dep: { | ||
chunks: "all", | ||
test: path.resolve(__dirname, "shared.js"), | ||
enforce: true | ||
} | ||
} | ||
} | ||
} | ||
}; |