ng build -prod FAILS with UglifyJs error when targeting ES2015!!
Bug Report or Feature Request (mark with an x)
- [X] bug report
- [ ] feature request
Versions.
Project 1: @angular/cli: 1.1.3 Project 2: @angular/cli: 1.3.0-rc.1
node: 7.10.0 os: win32 x64
In tsconfig.json: "target": "es2015"
Repro steps.
Create new app. Target tsconfig to ES2015. Build with -prod flag. Get the errors.
The log given by the failure.
ERROR in main.d3a567e3e4474c9592a2.bundle.js from UglifyJs Unexpected token: name (AppModule) [main.d3a567e3e4474c9592a2.bundle.js:23,6]
Mention any other details that might be useful.
When I set ES2015 as target in my tsconfig, I can't use -prod flag anymore! Getting UglifyJs errors! My limited research concludes that Uglify cannot parse ES6, link here: https://github.com/webpack/webpack/issues/2972#issuecomment-261705632
I need -prod flag, and I need to target ES2015. Am I missing something?
As far as I know UglifyJS does not support es2015.
This is a statement from the UglifyJS Readme:
Those wishing to minify ES2015+ (ES6+) should use the npm package uglify-es.
What @siedentm said is correct. Currently the CLI does not support ES2015 as an option when compiling modules I believe. The CLI would have to adjust the uglify plugin dependent on the module type set in the TSConfig.
Duplicate of https://github.com/angular/angular-cli/issues/2907
hello, I upgrade to angular 5 beta 4 and still get errror Unexpected token: name (AppModule), what should i do ?
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.