Skip to content

Instantly share code, notes, and snippets.

@dive2Pro
Created September 5, 2018 12:13
Show Gist options
  • Save dive2Pro/dde414cfd9d6618cc480bd588d52fa70 to your computer and use it in GitHub Desktop.
Save dive2Pro/dde414cfd9d6618cc480bd588d52fa70 to your computer and use it in GitHub Desktop.
export default {
plugins: [
[
'umi-plugin-react',
{
routes: {
exclude: [/exclude/]
},
dynamicImport: {
webpackChunkName: true,
level: 2
}
}
]
],
chainWebpack(config) {
const src_path = __dirname
const isSrc = path => path.indexOf('node_modules') === -1
config.optimization.splitChunks({
name: true,
chunks: 'all',
cacheGroups: {
srcCommon: {
name: 'src-common',
priority: 9,
minSize: 1,
chunks: 'all',
reuseExistingChunk: true,
test(module) {
if (!module || !isSrc(module.context)) {
return false
}
console.log(module.context, ' -- --')
return !isSrc(module.context)
},
minChunks: 2
},
verdors: {
name: 'verdors',
test: /[\\/]node_modules[\\/]/,
chunks: 'all',
priority: 1
}
}
})
return config
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment