Skip to content

Commit

Permalink
fix: reuseExistingChunk should be false by default
Browse files Browse the repository at this point in the history
  • Loading branch information
JSerFeng committed Aug 7, 2024
1 parent 1772f7c commit cebacb2
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl From<RawSplitChunksOptions> for rspack_plugin_split_chunks::PluginOptions {
.automatic_name_delimiter
.unwrap_or(overall_automatic_name_delimiter.clone()),
filename: v.filename.map(Filename::from),
reuse_existing_chunk: v.reuse_existing_chunk.unwrap_or(true),
reuse_existing_chunk: v.reuse_existing_chunk.unwrap_or(false),
// TODO(hyf0): the non-enforced default value should be 30
// I would set align default value with Webpack when the options is exposed to users
max_async_requests: u32::MAX,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const foo = 42;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import fs from 'fs'
import path from 'path'

it('should have extra chunk', () => {
expect(fs.existsSync(path.resolve(__dirname, 'foo-index_js.js'))).toBe(true)
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** @type {import("@rspack/core").Configuration} */
module.exports = {
target: "node",
output: {
filename: "[name].js"
},
optimization: {
chunkIds: 'named',
splitChunks: {
minSize: 1,
chunks: "all",
cacheGroups: {
foo: {
minSize: 0,
}
}
}
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import("../../../..").TConfigCaseConfig} */
module.exports = {
findBundle: function (i, options) {
return ["main.js"];
}
};

0 comments on commit cebacb2

Please sign in to comment.