7

I am getting

from UglifyJs SyntaxError: Unexpected token: punc (.)

error when running npm run build on angular2-webpack

This is coming from a spread operator.

Trying to demo a project in less than 1 hour.... FML

Oliver Millington
  • 4,839
  • 4
  • 17
  • 27

2 Answers2

-1

Changing the target from ES6 to ES5 can help. However, I was able to find a more reliable solution to use the advantages of ES6.

Simply specify UglifyJs in your package.json, and let npm handles the dependencies. "uglify-js": "git://github.com/mishoo/UglifyJS2#harmony-v2.8.22",

Burak Tasci
  • 857
  • 12
  • 18
-3

Turns out the fix is quite simple.

in tsconfig.json change

"target": "ES6"

to

"target": "ES5"
Oliver Millington
  • 4,839
  • 4
  • 17
  • 27