From da64db6d52d7444dc192f3b52620b4806de14014 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 31 Oct 2024 10:57:28 +0800 Subject: [PATCH 1/3] fix: splitChunk config in speedup mode --- .changeset/breezy-ants-clap.md | 5 +++++ packages/rspack-config/src/splitChunks.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/breezy-ants-clap.md diff --git a/.changeset/breezy-ants-clap.md b/.changeset/breezy-ants-clap.md new file mode 100644 index 0000000000..1ec79af278 --- /dev/null +++ b/.changeset/breezy-ants-clap.md @@ -0,0 +1,5 @@ +--- +'@ice/rspack-config': patch +--- + +fix: update splitChunk config diff --git a/packages/rspack-config/src/splitChunks.ts b/packages/rspack-config/src/splitChunks.ts index b186bfb769..e8b813a28e 100644 --- a/packages/rspack-config/src/splitChunks.ts +++ b/packages/rspack-config/src/splitChunks.ts @@ -88,7 +88,7 @@ export const getVendorStrategy = (options: Configuration['splitChunks']) => { const getSplitChunks = (_: string, strategy: string | boolean) => { if (strategy === false) { // Empty splitChunks configuration if strategy is false. - return {}; + return { minChunks: Infinity, cacheGroups: { default: false } }; } else if (typeof strategy === 'string' && ['page-vendors', 'vendors'].includes(strategy)) { const splitChunksOptions = strategy === 'page-vendors' ? { chunks: 'all' } : {}; return getVendorStrategy(splitChunksOptions); From ca654d8c86cc0ecb51f261db882aeb183e2205ed Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 31 Oct 2024 10:58:01 +0800 Subject: [PATCH 2/3] chore: remove comment --- packages/rspack-config/src/splitChunks.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/rspack-config/src/splitChunks.ts b/packages/rspack-config/src/splitChunks.ts index e8b813a28e..5224596212 100644 --- a/packages/rspack-config/src/splitChunks.ts +++ b/packages/rspack-config/src/splitChunks.ts @@ -87,7 +87,6 @@ export const getVendorStrategy = (options: Configuration['splitChunks']) => { const getSplitChunks = (_: string, strategy: string | boolean) => { if (strategy === false) { - // Empty splitChunks configuration if strategy is false. return { minChunks: Infinity, cacheGroups: { default: false } }; } else if (typeof strategy === 'string' && ['page-vendors', 'vendors'].includes(strategy)) { const splitChunksOptions = strategy === 'page-vendors' ? { chunks: 'all' } : {}; From 00063e85b5b6079a1cd43326b5d60a249c96d11a Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 31 Oct 2024 11:08:42 +0800 Subject: [PATCH 3/3] fix: update comment --- packages/rspack-config/src/splitChunks.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/rspack-config/src/splitChunks.ts b/packages/rspack-config/src/splitChunks.ts index 5224596212..9d2787ee95 100644 --- a/packages/rspack-config/src/splitChunks.ts +++ b/packages/rspack-config/src/splitChunks.ts @@ -87,7 +87,9 @@ export const getVendorStrategy = (options: Configuration['splitChunks']) => { const getSplitChunks = (_: string, strategy: string | boolean) => { if (strategy === false) { - return { minChunks: Infinity, cacheGroups: { default: false } }; + // Set minChunks to a large number to disable the splitChunks feature. + // the value of Infinity is not work properly for this version of rspack. + return { minChunks: 100000, cacheGroups: { default: false } }; } else if (typeof strategy === 'string' && ['page-vendors', 'vendors'].includes(strategy)) { const splitChunksOptions = strategy === 'page-vendors' ? { chunks: 'all' } : {}; return getVendorStrategy(splitChunksOptions);