Webpack: UglifyJS Syntax Error - Unexpected token: name (warn)

Created on 10 Feb 2017  路  1Comment  路  Source: vuejs-templates/webpack

I just updated my app to match the latest version of this template. But now when I try to do a production build, my vendor JS file isn't minified and I see the following error in the console:

ERROR in static/js/vendor.a39d919fc1717893bb98.js from UglifyJs
SyntaxError: Unexpected token: name (warn) [static/js/vendor.a39d919fc1717893bb98.js:69277,4]

The line it's complaining about looks like this:

// Copied from vue/src/core/util/debug.js

let warn = () => {} // This is the offending line...

But when I create a new empty project using this template, production builds work fine... I'm not sure what I'm doing wrong. Why would UglifyJS complain about what looks like a totally valid line of code? And why would a core Vue.js file be any different between my app and an empty project?

Can anybody shed some light on what might be going on here?

Most helpful comment

I figured out the issue... I'm using vue-awesome, and forgot that I had to modify the webpack config slightly to get it working.

For anybody else who might run into this, you need to add vue-awesome to the babel-loader config:

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

>All comments

I figured out the issue... I'm using vue-awesome, and forgot that I had to modify the webpack config slightly to get it working.

For anybody else who might run into this, you need to add vue-awesome to the babel-loader config:

      {
        test: /\.js$/,
        loader: 'babel-loader',
        include: [resolve('src'), resolve('test'), resolve('node_modules/vue-awesome')]
      }
Was this page helpful?
0 / 5 - 0 ratings