vuejs-templates / pwa

PWA template for vue-cli based on the webpack template
MIT License
3.04k stars 506 forks source link

npm run build => Unexpected token: name (joined) ... #167

Closed rico closed 6 years ago

rico commented 6 years ago

When I run npm run build, I get the following error:

ERROR in static/js/vendor.35ff2abaaeeb38512534.js from UglifyJs`
Unexpected token: name (joined) [./node_modules/vue-authorize/src/utils.js:164,0][static/js/vendor.35ff2abaaeeb38512534.js:24694,6]

I seems like babel is not transpiling ./node_modules/vue-authorize/src/utils.js (when I look at the generated vendor JS the whole package is no transpiled - all let etc still there) and UglifyJS does not understand es6.

Since I have no deeper knowledge of babel etc. I did not change any configuration files (except for names / meta information).

rico commented 6 years ago

I have found a solution - had to add the modules with es6 in it to webpack.base.conf.js

{
    test: /\.js$/,
    loader: 'babel-loader',
    include: [
      resolve('src'),
      resolve('test'),
      resolve('node_modules/vue-authorize'), // es6 module
      resolve('node_modules/animated-vue') // es6 module
    ]
  },

Additionally - for animated-vue, I had to install babel-preset-latest (throws some deprecation warnings when it installs).

Maybe there are better ways?