webpack-contrib/uglifyjs-webpack-plugin

Unexpected token: operator (>)

yashwanthkumarsuruneni opened this issue · 4 comments

  • Operating System: MacOS
  • Node Version: v10.12.0
  • NPM Version: 6.5.0
  • webpack Version: 4.28.4
  • uglifyjs-webpack-plugin Version: 2.1.1 , 2.1.2

Expected Behavior

Webpack build should not fail

Actual Behavior

Webpack build is failing showing the error ERROR in vendor.76ef4381718827d1db82.js from UglifyJs Unexpected token: operator (>) [vendor.76ef4381718827d1db82.js:12729,18]

How Do We Reproduce?

The build is failing with react 16.7.0

Did you try setting sourceMap to true to see where this is coming from? It's probable that you are trying to minify es6 code (probably from node_modules).

Yes i see it coming from one of my node_modules ,
Unexpected token: operator (>) [./node_modules/amazon-cognito-auth-js/es/DecodingHelper.js:1,7][vendor.2c9456026e3cb1d8ebd2.js:12729,18] switched to terser-webpack-plugin started working fine , I see an open issue here amazon-archives/amazon-cognito-auth-js#186

I also have this problem, when I replace uglifyjs-webpack-plugin 1.x with 2.x

The reason is uglifyjs-webpack-plugin 2.x depend on uglify-js, while uglify-js only supports JavaScript (ECMAScript 5) ,
uglifyjs-webpack-plugin 1.x depend on uglify-es, uglify-es supports ECMAScript 6

Problem on uglify-js side, you can post issue in their repo, anyway we strongly recommend use terser-webpack-plugin, sorry we can't do anything on our side here, thanks