vue.js - vue/cli3.0时使用DllPlugin和DllReferencePlugin错误
问题描述
我想拉出依赖包,但我遇到了问题。使用 vue/cli3.0
在线链接是https://github.com/Sayid1/dll-test
主要代码
vue.config.js
var bundleConfig = require('./bundle-config.json')
module.exports = {
configureWebpack: {
plugins: [
new webpack.DllReferencePlugin({
manifest: require('./dll/manifest.json')
}),
new HtmlWebpackPlugin({
inject: true,
template: './public/index.html',
filename: 'index.html',
vendorJsName: bundleConfig.vender.js,
})
]
}
}
webpack.config.dll.js
const AssetsPlugin = require('assets-webpack-plugin')
module.exports = {
entry: {
vender: ['vue/dist/vue.runtime.common.js']
},
output: {
path: path.join(__dirname, 'dll'),
filename: 'dll.[name]_[hash].js',
library: '[name]_[hash]'
},
plugins: [
new webpack.DllPlugin({
name: '[name]_[hash]',
path: path.join(__dirname, 'dll', 'manifest.json')
}),
new AssetsPlugin({
filename: 'bundle-config.json',
path: './'
})
]
}
我运行这个脚本:
webpack -p --progress --config webpack.config.dll.js
然后启动服务器
发生了错误。
Uncaught SyntaxError: Unexpected token <
Uncaught ReferenceError: vender_87f3be8acd6aadd91537 is not defined
at eval (eval at dll-reference vender_87f3be8acd6aadd91537 (app.js:2106), <anonymous>:1:18)
at Object.dll-reference vender_87f3be8acd6aadd91537 (app.js:2106)
at __webpack_require__ (app.js:724)
at fn (app.js:101)
at eval (global.js from dll-reference vender_87f3be8acd6aadd91537?478a:1)
at Object../node_modules/webpack/buildin/global.js (app.js:1896)
at __webpack_require__ (app.js:724)
at fn (app.js:101)
at eval (punycode.js:521)
at Object../node_modules/node-libs-browser/node_modules/punycode/punycode.js (app.js:1685)
解决方案
推荐阅读
- html - video.js 主题有错误
- mathjax - 我怎样才能中断变量名?
- python - 如何预测 Keras 中每个序列的多个值?LSTM 层
- iframe - 第三方重定向在 iframe 内的 Samesite Lax 预期行为
- c - 立即复制宏中的文本
- javascript - 两个手风琴,但仅使用 Javascript 为第一个箭头设置动画
- c++ - 为什么下面这段代码返回的是指针指向的值而不是指针的地址?
- c++ - 从 GUI 文件资源管理器执行程序,并且不生成终端
- c++ - 有没有办法使用 VFW 将压缩的视频数据写入缓冲区而不是文件?
- xcode - _shouldMakeReadyForDevelopment 检查失败,即使设备没有被密码锁定