feat(cli): Adding support for custom uglify options in .angular-cli.json #5192
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adding an option into the
.angular-cli.json
to provide custom options to the UglifyJsPlugin that is used for production builds.Why?
We are using some older libraries inside our Angular application that when we build for production we require the
compress: { keep_fnames: true }
on the UglifyJsPlugin plugin. The CLI does not currently support this, so I added a way to pass any options to the UglifyJsPlugin.The
.angular-cli.json
can now have the following property:Then this will just merge the already defaulted options that were there with any new options that the user needs or wants.
This issue was brought up and closed in a few PRs and tickets, but there was never a solution. (#1662 & #3167)