UglifyJs: Unexpected token: operator (>)
See original GitHub issueWhen 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:
- Created 6 years ago
- Reactions:25
- Comments:46 (10 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same problem.
For
webpack
v3 onwards the aliasing forUglifyJS
is changed. Refer https://github.com/webpack-contrib/uglifyjs-webpack-plugin.So for me modifying my
webpack.config.js
from to usenew UglifyJsPlugin()
rather thannew webpack.optimize.UglifyJsPlugin()
fixed the issue.Reference: https://github.com/joeeames/WebpackFundamentalsCourse/issues/3#issuecomment-352541826