Skip to content

Commit 1bced60

Browse files
authored
feat: only split async chunks for umd format (#1194)
1 parent 02278ff commit 1bced60

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/core/src/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,10 @@ const composeFormatConfig = ({
718718
},
719719
optimization: {
720720
nodeEnv: process.env.NODE_ENV,
721+
splitChunks: {
722+
// sync chunk of umd can not be loaded without mounting on scripts
723+
chunks: 'async',
724+
},
721725
},
722726
plugins,
723727
},

packages/core/tests/__snapshots__/config.test.ts.snap

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2201,7 +2201,9 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
22012201
},
22022202
optimization: {
22032203
minimize: true,
2204-
splitChunks: false,
2204+
splitChunks: {
2205+
chunks: 'async'
2206+
},
22052207
minimizer: [
22062208
/* config.optimization.minimizer('js') */
22072209
new SwcJsMinimizerRspackPlugin(
@@ -4154,6 +4156,9 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
41544156
},
41554157
"optimization": {
41564158
"nodeEnv": undefined,
4159+
"splitChunks": {
4160+
"chunks": "async",
4161+
},
41574162
},
41584163
"output": {
41594164
"asyncChunks": false,

0 commit comments

Comments
 (0)