question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UglifyJs: Unexpected token: operator (>)

See original GitHub issue

When running npm run production I get the following error:

/js/listing.js from UglifyJs
Unexpected token: operator (>) [./~/bootstrap/js/src/dropdown.js:11,0][/js/listing.js:3302,23]

I’ve tried deleting node_modules without any luck, same goes for installing:

yarn add --dev git+https://github.com/mishoo/UglifyJS2.git#harmony

Arrow function seem to be the issue, line 11 of dropdown.js is:

const Dropdown = (($) => {

I don’t have a .babelrc file.

laravel-mix@0.11.4
Node: v7.9.0
NPM: 4.5.0
macOS: 10.12.4

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:25
  • Comments:46 (10 by maintainers)

github_iconTop GitHub Comments

33reactions
Shchepotincommented, May 9, 2017

Same problem.

19reactions
hozefajcommented, Feb 14, 2018

For webpack v3 onwards the aliasing for UglifyJS is changed. Refer https://github.com/webpack-contrib/uglifyjs-webpack-plugin.

So for me modifying my webpack.config.js from to use new UglifyJsPlugin() rather than new webpack.optimize.UglifyJsPlugin() fixed the issue.

Reference: https://github.com/joeeames/WebpackFundamentalsCourse/issues/3#issuecomment-352541826

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack - Unexpected token: operator (>) from UglifyJs
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...
Read more >
Bug, UglifyJs Unexpected token: operator (>) · Issue #593
What is the expected behaviour? building without error, no polyfills (fetch), modern ES output (class, fatarrows), ideally minified. Please ...
Read more >
How I Fixed: UglifyJs Unexpected token: name (DropIn)
I've been trying – in vain – to build the front end for CodeReviewVideos. The issue I have been hitting upon is as...
Read more >
Unexpected token: operator (>) from UglifyJs - Get Help
So for me modifying my webpack.config.js from to use new UglifyJsPlugin() rather than new webpack.optimize.UglifyJsPlugin() fixed the issue.
Read more >
SPFX 2019 Unexpected token - Uglify - Mathias Osterkamp
The problem ist, that third party library uses ES6 code and UglifyJS ist not able to compile ES6. Solution. UglifyJS does not support...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found