Skip to content

Commit

Permalink
chore: add splitChunks options.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Feb 10, 2022
1 parent 7de4ee1 commit ca0b1cb
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .kktrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,39 @@ export default (conf: Configuration, env: 'production' | 'development', options:
}));
if (env === 'production') {
conf.output = { ...conf.output, publicPath: './' };
conf.optimization = {
...conf.optimization,
splitChunks: {
automaticNameDelimiter: '.',
maxSize: 500000,
maxInitialRequests: 20,
minSize: 100000,
cacheGroups: {
reactvendor: {
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/,
name: 'react-vendor',
reuseExistingChunk: true,
chunks: 'all',
priority: -10,
},
monacoeditor: {
test: /[\\/]node_modules[\\/](monaco-editor)[\\/]/,
name: 'monaco-editor-vendor',
chunks: 'all',
},
codeexample: {
test: /[\\/]node_modules[\\/](code-example)[\\/]/,
name: 'code-example',
chunks: 'all',
},
refractor: {
test: /[\\/]node_modules[\\/](refractor)[\\/]/,
name: 'refractor-vendor',
chunks: 'all',
},
},
},
};
}
return conf;
}

0 comments on commit ca0b1cb

Please sign in to comment.