Node.js/webpack/SplitChunksPlugin:修订间差异
来自康健生活
创建页面,内容为“== 引言 == <syntaxhighlight lang="javascript"> optimization: { splitChunks: { chunks: "initial", // 代码块类型 必须三选一: "initial"…” |
|||
| 第23行: | 第23行: | ||
} | } | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||
{{unknown| | {{unknown|寻找蓝海96}} | ||
拆包 | |||
<syntaxhighlight lang="javascript"> | |||
cacheGroups: { | |||
reactBase: { | |||
name: 'reactBase', | |||
test: (module) => { | |||
return /react|redux/.test(module.context); | |||
}, | |||
chunks: 'initial', | |||
priority: 10, | |||
}, | |||
utilBase: { | |||
name: 'utilBase', | |||
test: (module) => { | |||
return /rxjs|lodash/.test(module.context); | |||
}, | |||
chunks: 'initial', | |||
priority: 9, | |||
}, | |||
uiBase: { | |||
name: 'chartBase', | |||
test: (module) => { | |||
return /echarts/.test(module.context); | |||
}, | |||
chunks: 'initial', | |||
priority: 8, | |||
}, | |||
commons: { | |||
name: 'common', | |||
chunks: 'initial', | |||
priority: 2, | |||
minChunks: 2, | |||
}, | |||
}</syntaxhighlight> | |||