[英]Compiled app with latest UglifyJsPlugin for Webpack displays “ webpackJsonp is not defined”
I'm using the official Vue Webpack template . 我正在使用官方的Vue Webpack模板 。
The UglifyJs that comes with Webpack doesn't compile ES6. Webpack随附的UglifyJs无法编译ES6。 So I changed it for the standalone version of the Webpack plugin:
所以我将其更改为Webpack插件的独立版本 :
// webpack.prod.conf.js
var UglifyJsPlugin = require('uglifyjs-webpack-plugin')
new UglifyJsPlugin({
uglifyOptions: {
ie8: false,
ecma: 8,
parse: {},
mangle: {
properties: {
// mangle property options
}
},
output: {
comments: false,
beautify: false,
},
compress: {},
warnings: false
}
}),
When I do npm run build
the app compiles properly. 当我执行
npm run build
应用程序会正确编译。 However, when I do npm start
and visit localhost:3000
I get this error: 但是,当我执行
npm start
并访问localhost:3000
此错误:
vendor.dc780f28ecc8d64eb53a.js:1 Uncaught ReferenceError: webpackJsonp is not defined
at vendor.dc780f28ecc8d64eb53a.js:1
(anonymous) @ vendor.dc780f28ecc8d64eb53a.js:1
app.470f1cb076c387c73cdc.js:1 Uncaught ReferenceError: webpackJsonp is not defined
at app.470f1cb076c387c73cdc.js:1
(anonymous) @ app.470f1cb076c387c73cdc.js:1
babel-polyfill.fc14d31ef0450ee23f4b.js:1 Uncaught ReferenceError: webpackJsonp is not defined
at babel-polyfill.fc14d31ef0450ee23f4b.js:1
What could be the reason? 可能是什么原因?
尝试使用:
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js', Infinity)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.