Uglify Syntax Issue
See original GitHub issueWhen running npm run build
I get the following error:
ERROR in static/js/app.6689fc597972447f1496.js from UglifyJs
SyntaxError: Unexpected token punc «(», expected punc «:» [static/js/app.6689fc597972447f1496.js:94,5]
However it’s not present during npm run dev
and the website is served fine. My best guess is that Babel isn’t being run on some files causeing Uglify to fail when run. Full console output below:
$ npm run build
> project@1.0.0 build /Users/username/project
> node build/build.js
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
Hash: bd805cd988b6f7006493
Version: webpack 2.2.1
Time: 5153ms
Asset Size Chunks Chunk Names
static/js/app.6689fc597972447f1496.js 5.88 kB 0, 2 [emitted] app
static/js/vendor.1cef0cb656c37a98743e.js 98.2 kB 1, 2 [emitted] vendor
static/js/manifest.4f3351c401b7d9bd469b.js 1.44 kB 2 [emitted] manifest
static/css/app.0241d69426e0d359e8bdc1e9d0d7563c.css 274 bytes 0, 2 [emitted] app
static/js/app.6689fc597972447f1496.js.map 9.18 kB 0, 2 [emitted] app
static/css/app.0241d69426e0d359e8bdc1e9d0d7563c.css.map 488 bytes 0, 2 [emitted] app
index.html 527 bytes [emitted]
ERROR in static/js/app.6689fc597972447f1496.js from UglifyJs
SyntaxError: Unexpected token punc «(», expected punc «:» [static/js/app.6689fc597972447f1496.js:94,5]
Build complete.
Tip: built files are meant to be served over an HTTP server.
Opening index.html over file:// won't work.
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Uglify SyntaxError: Unexpected token: punc ()) - Stack Overflow
As we just imported the raw source file, but babel is only transpiling files outside of node_modules, uglify got confused by the ES6...
Read more >uglify-js - npm
UglifyJS is a JavaScript parser, minifier, compressor and beautifier toolkit. Note: uglify-js supports JavaScript and most language features in ...
Read more >Terser vs. Uglify vs. babel-minify: Comparing JavaScript ...
See how Terser compares to UglifyJS and babel-minify. ... The Terser command line has the following syntax: terser [input files] [options].
Read more >JavaScript : Uglify SyntaxError: Unexpected token: punc ()
JavaScript : Uglify SyntaxError : Unexpected token: punc ()) ... If there any issues, contact us on - htfyc dot hows dot tech ......
Read more >Uglify-js errors on MDB.JS - Material Design for Bootstrap
I run uglify-js on my system and up till MDB-Pro version 4.7.4 this ran fine. After updating to mdb-pro version 4.8.2 a couple...
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 Free
Top 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
Latest commit seems to work fine.
Pulling up the non-uglified output, I believe I’ve found the issue:
The
data(){
line isn’t valid ES5 JSON syntax. Should bedata: function(){
, this is being pulled in from a .vue file.