Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -715,13 +715,13 @@ exports[`uni-builder rspack > should generator rspack config correctly 1`] = `
"name": "lib-react",
"priority": 0,
"reuseExistingChunk": true,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react\\|react-dom\\|scheduler\\|react-refresh\\|@rspack\\\\/plugin-react-refresh\\)\\[\\\\\\\\/\\]/,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react\\|react-dom\\|scheduler\\|react-refresh\\|@rspack\\[\\\\\\\\/\\]plugin-react-refresh\\)\\[\\\\\\\\/\\]/,
},
"lib-router": {
"name": "lib-router",
"priority": 0,
"reuseExistingChunk": true,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react-router\\|react-router-dom\\|@remix-run\\\\/router\\|history\\)\\[\\\\\\\\/\\]/,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react-router\\|react-router-dom\\|history\\|@remix-run\\[\\\\\\\\/\\]router\\)\\[\\\\\\\\/\\]/,
},
},
"chunks": "all",
Expand Down Expand Up @@ -1555,7 +1555,7 @@ exports[`uni-builder rspack > should generator rspack config correctly when prod
"name": "lib-router",
"priority": 0,
"reuseExistingChunk": true,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react-router\\|react-router-dom\\|@remix-run\\\\/router\\|history\\)\\[\\\\\\\\/\\]/,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react-router\\|react-router-dom\\|history\\|@remix-run\\[\\\\\\\\/\\]router\\)\\[\\\\\\\\/\\]/,
},
},
"chunks": "all",
Expand Down Expand Up @@ -2305,13 +2305,13 @@ exports[`uni-builder webpack > should generator webpack config correctly 1`] = `
"name": "lib-react",
"priority": 0,
"reuseExistingChunk": true,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react\\|react-dom\\|scheduler\\|react-refresh\\|@rspack\\\\/plugin-react-refresh\\)\\[\\\\\\\\/\\]/,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react\\|react-dom\\|scheduler\\|react-refresh\\|@rspack\\[\\\\\\\\/\\]plugin-react-refresh\\)\\[\\\\\\\\/\\]/,
},
"lib-router": {
"name": "lib-router",
"priority": 0,
"reuseExistingChunk": true,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react-router\\|react-router-dom\\|@remix-run\\\\/router\\|history\\)\\[\\\\\\\\/\\]/,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react-router\\|react-router-dom\\|history\\|@remix-run\\[\\\\\\\\/\\]router\\)\\[\\\\\\\\/\\]/,
},
},
"chunks": "all",
Expand Down Expand Up @@ -3129,7 +3129,7 @@ exports[`uni-builder webpack > should generator webpack config correctly when pr
"name": "lib-router",
"priority": 0,
"reuseExistingChunk": true,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react-router\\|react-router-dom\\|@remix-run\\\\/router\\|history\\)\\[\\\\\\\\/\\]/,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react-router\\|react-router-dom\\|history\\|@remix-run\\[\\\\\\\\/\\]router\\)\\[\\\\\\\\/\\]/,
},
},
"chunks": "all",
Expand Down
6 changes: 4 additions & 2 deletions packages/plugin-react/src/splitChunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@ export const applySplitChunksRule = (
'react',
'react-dom',
'scheduler',
...(isProd() ? [] : ['react-refresh', '@rspack/plugin-react-refresh']),
...(isProd()
? []
: ['react-refresh', /@rspack[\\/]plugin-react-refresh/]),
];
}

if (options.router) {
extraGroups.router = [
'react-router',
'react-router-dom',
'@remix-run/router',
'history',
/@remix-run[\\/]router/,
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ exports[`splitChunks > should apply antd/semi/... splitChunks rule when pkg is i
"name": "lib-react",
"priority": 0,
"reuseExistingChunk": true,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react\\|react-dom\\|scheduler\\|react-refresh\\|@rspack\\\\/plugin-react-refresh\\)\\[\\\\\\\\/\\]/,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react\\|react-dom\\|scheduler\\|react-refresh\\|@rspack\\[\\\\\\\\/\\]plugin-react-refresh\\)\\[\\\\\\\\/\\]/,
},
"lib-router": {
"name": "lib-router",
"priority": 0,
"reuseExistingChunk": true,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react-router\\|react-router-dom\\|@remix-run\\\\/router\\|history\\)\\[\\\\\\\\/\\]/,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react-router\\|react-router-dom\\|history\\|@remix-run\\[\\\\\\\\/\\]router\\)\\[\\\\\\\\/\\]/,
},
},
"chunks": "all",
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-react/tests/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -638,13 +638,13 @@ exports[`plugins/react > should work with swc-loader 1`] = `
"name": "lib-react",
"priority": 0,
"reuseExistingChunk": true,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react\\|react-dom\\|scheduler\\|react-refresh\\|@rspack\\\\/plugin-react-refresh\\)\\[\\\\\\\\/\\]/,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react\\|react-dom\\|scheduler\\|react-refresh\\|@rspack\\[\\\\\\\\/\\]plugin-react-refresh\\)\\[\\\\\\\\/\\]/,
},
"lib-router": {
"name": "lib-router",
"priority": 0,
"reuseExistingChunk": true,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react-router\\|react-router-dom\\|@remix-run\\\\/router\\|history\\)\\[\\\\\\\\/\\]/,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react-router\\|react-router-dom\\|history\\|@remix-run\\[\\\\\\\\/\\]router\\)\\[\\\\\\\\/\\]/,
},
},
"chunks": "all",
Expand Down
5 changes: 1 addition & 4 deletions packages/plugin-vue/src/splitChunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ export const applySplitChunksRule = (
extraGroups.vue = [
'vue',
'vue-loader',
'@vue/shared',
'@vue/reactivity',
'@vue/runtime-dom',
'@vue/runtime-core',
/@vue[\\/](shared|reactivity|runtime-dom|runtime-core)/,
];
}

Expand Down