Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected token: operator (>) from UglifyJs #459

Closed
Zysce opened this issue May 10, 2017 · 1 comment
Closed

Unexpected token: operator (>) from UglifyJs #459

Zysce opened this issue May 10, 2017 · 1 comment

Comments

@Zysce
Copy link

Zysce commented May 10, 2017

I have 2 Vue-Cli webpack projects (ClientApp and Lib).
Lib is my components library (shared with other projects)

Problem

When I build my project ClientApp npm run build, I have the following error:

ERROR in static/js/app.d08a24ce0e8d0438ce68.js from UglifyJs
Unexpected token: operator (>) [C:/.../Lib/src/tools/escape-key.js:3,0][static/js/app.d08a24ce0e8d0438ce68.js:17468,38]

Questions

It seems like the error comes from an arrow function in the file escape-key.js.
This is ES6 syntax and UglifyJS can't parse this.
Shouldn't Babel go first, before Uglify?
Note that is works well with *.vue files.

Project structure

ClientApp
   | - build
   | - config
   | - src
       | - App.Vue // import EscapeKey from '~lib/tools/escape-key';
Lib
  | -src
     | - tools
         | - escape-key.js

ClientApp's webpack.base.conf.js file

Note there is an alias to Lib.

resolve: {
    extensions: ['.js', '.vue', '.json'],
    alias: {
      '@': resolve('src'),
      '~lib': path.join(__dirname, '../../lib/src'),
    }
  },

Please feel free to ask for more details if required.

@posva
Copy link
Member

posva commented May 10, 2017

Please ask questions on the forum or StackOverflow. It'll be easier if you share your project code too

@posva posva closed this as completed May 10, 2017
@Zysce Zysce changed the title ES6 syntax is not transpiled from import in Vue file Unexpected token: operator (>) from UglifyJs May 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants