vue+element-ui build 出现 UglifyJs Unexpected token: punc 问题

1、报错:

ERROR in static/js/vendor.b42509bed96843193b81.js from UglifyJs

Unexpected token: punc ()) [./~/[email protected]@element-ui/src/utils/resize-event.js:73,0][static/js/vendor.b42509bed96843193b81.js:154155,37]

2、解决方案:

build/webpack.base.conf.js 文件中的  loader:'babel-loader'那块 添加resolve('/node_modules/[email protected]@element-ui/src/utils/resize-event.js')如下内容:

也可添加resolve('/node_modules/_element-ui') ---可不受版本号影响

rules: [

  {

test:/\.vue$/,

    loader:'vue-loader',

    options:vueLoaderConfig

  },

  {

test:/\.js$/,

    loader:'babel-loader',

    include: [resolve('src'), resolve('test'),resolve('/node_modules/_element-ui')]

},

你可能感兴趣的:(vue+element-ui build 出现 UglifyJs Unexpected token: punc 问题)