forked from webpack/webpack
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix bug where module size is added multiple times to the split chunk …
…info fixes webpack#12307
- Loading branch information
Showing
8 changed files
with
43 additions
and
3 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
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 "./a-only-module"; | ||
import "./shared-module"; |
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(/* webpackChunkName: "shared-module" */ "./shared-module"); |
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,4 @@ | ||
it("should not split the shared-modules into a separate chunk", () => { | ||
const shared = __STATS__.modules.find(m => m.name.includes("shared-module")); | ||
expect(shared.chunks).toEqual(["a", "shared-module"]); | ||
}); |
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 @@ | ||
// content content content content content content content content content |
27 changes: 27 additions & 0 deletions
27
test/configCases/split-chunks/issue-12307/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,27 @@ | ||
/** @type {import("../../../../").Configuration} */ | ||
module.exports = { | ||
entry: { | ||
bundle0: "./index", | ||
a: "./a", | ||
b: "./b" | ||
}, | ||
output: { | ||
filename: "[name].js" | ||
}, | ||
optimization: { | ||
chunkIds: "named", | ||
sideEffects: false, | ||
splitChunks: { | ||
cacheGroups: { | ||
default: false, | ||
defaultVendors: false, | ||
test: { | ||
test: /shared/, | ||
minChunks: 1, | ||
chunks: "initial", | ||
minSize: 100 | ||
} | ||
} | ||
} | ||
} | ||
}; |