`
wangpf2013
  • 浏览: 9650 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

vue 构建失败 --Unexpected token: punc (()

    博客分类:
  • vue
阅读更多

npm run build 构建失败

 

vue 打包出错——Unexpected token: punc (()

 

ERROR in static/js/vendor.01f38d9d512d1cb86953.js from UglifyJs  
Unexpected token: punc (() [./node_modules/_element-ui@2.0.5@element-ui/src/mixins/migrating.js:23,0][static/js/vendor.01f38d9d512d1cb86953.js:52337,9]  
   
  Build failed with errors.  
   
npm ERR! code ELIFECYCLE  
npm ERR! errno 1  
npm ERR! battery@1.0.0 build: `node build/build.js`  
npm ERR! Exit status 1  
npm ERR!  
npm ERR! Failed at the battery@1.0.0 build script.  
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.  
   
npm ERR! A complete log of this run can be found in:  
npm ERR!     E:\Program Files\nodejs\node_cache\_logs\2018-03-07T02_24_43_985Z-debug.log  

 

 

webpack.base.conf.js

 

module: {  
    rules: [  
      {  
        test: /\.vue$/,  
        loader: 'vue-loader',  
        options: vueLoaderConfig  
      },  
      {  
        test: /\.js$/,  
        loader: 'babel-loader',  
        include: [resolve('src'), resolve('test'),resolve('/node_modules/element-ui/src'),resolve('/node_modules/element-ui/packages')]  
      },  

 

打包需要的文件在_element-ui@2.0.5@element-ui 包中,但是_element-ui@2.0.5@element-ui 包没有在 webpack.base.conf.js 中进行配置。

 

解决办法:

删除 node_modules 下的 
 _element-ui@2.0.5@element-ui
element-ui

然后重新放入最新版本的的 element-ui包。

问题解决。


参考文档:http://blog.csdn.net/wild46cat/article/details/78024796

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics