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

阅读更多

npm run build 构建失败

 

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

 

ERROR in static/js/vendor.01f38d9d512d1cb86953.js from UglifyJs  
Unexpected token: punc (() [./node_modules/[email protected]@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! [email protected] build: `node build/build.js`  
npm ERR! Exit status 1  
npm ERR!  
npm ERR! Failed at the [email protected] 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')]  
      },  

 

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

 

解决办法:

删除 node_modules 下的 
 [email protected]@element-ui
element-ui

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

问题解决。


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

 

你可能感兴趣的:(vue,npm,打包,Unexpected,token,punc)