Skip to content

Commit

Permalink
fix: optimize split-chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
shuashuai committed May 7, 2024
1 parent 4a762f9 commit 046015f
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions ui/config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,47 +44,45 @@ module.exports = {
minChunks: 2,
cacheGroups: {
automaticNamePrefix: 'chunk',
components: {
test: /[\\/]components[\\/]/,
name: 'components',
priority: 14,
reuseExistingChunk: true,
minChunks: process.env.NODE_ENV === 'production' ? 1 : 2,
chunks: 'initial',
},
mix1: {
test: (module, chunks) => {
return (
module.resource &&
(module.resource.includes('components') ||
/\/node_modules\/react-bootstrap\//.test(module.resource))
);
},
name: 'chunk-mix1',
test: /[\/]node_modules[\/](i18next|lodash|marked|next-share)[\/]/,
filename: 'static/js/[name].[contenthash:8].chunk.js',
priority: 12,
priority: 14,
reuseExistingChunk: true,
minChunks: 1,
minChunks: process.env.NODE_ENV === 'production' ? 1 : 2,
chunks: 'initial',
},
mix2: {
name: 'chunk-mix2',
test: /[\/]node_modules[\/](@remix-run|@restart|axios|diff)[\/]/,
test: /[\/]node_modules[\/](i18next|lodash|marked|next-share)[\/]/,
filename: 'static/js/[name].[contenthash:8].chunk.js',
priority: 11,
priority: 13,
reuseExistingChunk: true,
minChunks: 1,
chunks: 'initial',
},
reactBootstrap: {
name: 'react-bootstrap',
test: /[\/]node_modules[\/](react-bootstrap)[\/]/,
mix3: {
name: 'chunk-mix3',
test: /[\/]node_modules[\/](@remix-run|@restart|axios|diff)[\/]/,
filename: 'static/js/[name].[contenthash:8].chunk.js',
priority: 11,
priority: 12,
reuseExistingChunk: true,
minChunks: 1,
chunks: 'initial',
reuseExistingChunk: true,
},
codemirror: {
name: 'codemirror',
test: /[\/]node_modules[\/](\@codemirror)[\/]/,
priority: 9,
priority: 10,
reuseExistingChunk: true,
minChunks: 1,
minChunks: process.env.NODE_ENV === 'production' ? 1 : 2,
chunks: 'initial',
enforce: true,
},
Expand All @@ -93,15 +91,15 @@ module.exports = {
test: /[\/]node_modules[\/](\@lezer)[\/]/,
priority: 9,
reuseExistingChunk: true,
minChunks: 1,
minChunks: process.env.NODE_ENV === 'production' ? 1 : 2,
chunks: 'initial',
enforce: true,
},
reactDom: {
name: 'react-dom',
test: /[\/]node_modules[\/](react-dom)[\/]/,
filename: 'static/js/[name].[contenthash:8].chunk.js',
priority: 7,
priority: 8,
reuseExistingChunk: true,
chunks: 'all',
enforce: true,
Expand Down

0 comments on commit 046015f

Please sign in to comment.