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.

Uglify Syntax Issue

See original GitHub issue

When 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:closed
  • Created 7 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mesqukacommented, Feb 10, 2017

Latest commit seems to work fine.

1reaction
mesqukacommented, Feb 10, 2017

Pulling up the non-uglified output, I believe I’ve found the issue:

/* harmony default export */ __webpack_exports__["default"] = {
	name: 'feed',
	data() {
		return {
			msg: 'App'
		};
	}
};

The data(){ line isn’t valid ES5 JSON syntax. Should be data: function(){, this is being pulled in from a .vue file.

Read more comments on GitHub >

github_iconTop 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 >

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