Angular-cli: uglify option

Created on 29 Jul 2017  路  6Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Desired functionality.

I've created a new staging environment. I use the -aot flag for this. However, I would also like to minify and uglify chunks. I can't find any option in docs or ng --help

It would be great if there was a --uglify option

Most helpful comment

Than you can ~either use only --target=production flag (which enables UglifyJS with other production optimizations) or~ override environment with extra flag, e.g. --prod --environment=staging.

All 6 comments

You probably want to use --prod meta flag, which will enable couple of flags you likely want to have enabled for production build. AoT, uglify, tree-shaking included :)

@devoto13 that wouldn't work with production variables like endpoints. If I did that, then production endpoints would be used in staging

Than you can ~either use only --target=production flag (which enables UglifyJS with other production optimizations) or~ override environment with extra flag, e.g. --prod --environment=staging.

Thanks @devoto13 . The second solution did work. Would it be a good idea to include this as a comment in the docs? Happy to do the pull request

@devoto13's answer is the recommended way, you can specifiy target and environment separate. There is already a section of the docs for this: https://github.com/angular/angular-cli/wiki/build#build-targets-and-environment-files

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._

Was this page helpful?
0 / 5 - 0 ratings