猿问

webpack4 splitChunks用法?提取?万分感谢

我搭建的是一个单页应用想用webpack4下的splitChunks功能想将node_modules引用的模块比如vue之类的提取放到一个js文件下但是怎么提都提不出来一点反应都没有,这是怎么回事?optimization:{splitChunks:{chunks:'initial',//默认只作用于异步模块,为`all`时对所有模块生效,`initial`对同步模块有效minSize:30000,//合并前模块文件的体积minChunks:1,//最少被引用次数maxAsyncRequests:5,maxInitialRequests:3,automaticNameDelimiter:'~',cacheGroups:{vendors:{test:/node_modules/,minChunks:1,priority:-10},default:{test:/src/,minChunks:2,priority:-20,reuseExistingChunk:true}}}},
慕勒3428872
浏览 1239回答 2
2回答

MM们

splitChunks:{cacheGroups:{manifest:{name:"manifest",chunks:"initial",minChunks:2},vendor:{chunks:"all",test:/[\\/]node_modules[\\/]/,name:"vendor",minChunks:1,maxInitialRequests:5,minSize:0,priority:98}}}},
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答