vue build failed --Unexpected token: punc (()

npm run build build fails

 

vue packaging error - 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')]  
      },  

 

The files required for packaging are in the [email protected]@element-ui package, but the [email protected]@element-ui package is not configured in webpack.base.conf.js.

 

Solution:

Widget node_modules 
 [email protected]@element-ui
element-ui

Then re-insert the latest version of the element-ui package.

problem solved.


Reference document: http://blog.csdn.net/wild46cat/article/details/78024796

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326220900&siteId=291194637