使用dllPlugin 和DllReferencePlugin 分离第三方库
dll配置文件
module.exports = {
entry: {
vendor: ['vue', 'vue-router']
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js',
library: '[name]'
},
plugins: [
new webpack.DllPlugin({
path: path.join(
__dirname,
"[name]-manifest.json"
),
name: "[name]",
context: __dirname
}),
new webpack.optimize.UglifyJsPlugin({
// mangle:true,
compress: {
warnings: false
},
output: {
comments: false
}
})
]
// new AssetsPlugin({
// filename: 'bundle-config.json',
// path: __dirname
// })
}
webpack.config.js配置文件
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require("./vendor-manifest.json")
}),
new HtmlWebpackPlugin({
filename: "index.html",
template: "index.html",
inject: true
}),
new AddAssetHtmlPlugin({![![图片描述][2]][3]
filepath: require.resolve("./dist/vendor.js"),
hash: true,
includeSourcemap: false
}),
执行npm run dll 没问题
然后执行npm run watch 命令行一直在打包文件
您好 请问解决了吗?是怎么解决的