Neriya Rosner
Neriya Rosner

Reputation: 43

angular-cli: "SyntaxError: Unexpected token" when compiling for production and AOT

I am using angular2 typescript and compiling with angular-CLI

when I try to compile with AOT and production ng build --aot --prod i get an error for no reason:

ERROR in main.4b427a390fd79800862f.bundle.js from UglifyJs
SyntaxError: Unexpected token: name (UriPipe) [main.4b427a390fd79800862f.bundle.js:19,4]

but the code is fine.. and when I compile for development (without uglify) all works fine

(UriPipe is a pipe I made which works ok)

versions:

os: ubuntu 16.04 LTS / Windows 10 x64
browser: chrome v56
angular-cli: 1.0.0-beta.26
node: 6.9.4
npm: 3.10.10
typescript: 2.0.10
angular2: 2.3.1

Upvotes: 0

Views: 2685

Answers (1)

Neriya Rosner
Neriya Rosner

Reputation: 43

I found the answer. The problem was in the tsconfig.json the target was set to es6 and uglifyjs works only for es5

Upvotes: 1

Related Questions