Skip to content

fix(@angular-devkit/build-angular): prevent optimization adding unsupported ECMASCript features #24353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2022

Conversation

clydin
Copy link
Member

@clydin clydin commented Nov 30, 2022

When optimization is enabled with the @angular-devkit/build-angular:browser builder, terser is used as a second phase optimizer. The terser configuration previously set its ecma option to es2020 due to all officially supported browsers supporting the version. However, it is possible to add browsers to the browserslist configuration that are not officially supported that still may work but do not support es2020 syntax features. By setting the terser ecma option to es2015, terser will not turn existing syntax into newer syntax features that might be unsupported. Terser will also not downlevel any code based on this option.

Fixes #24347

…ported ECMASCript features

When optimization is enabled with the `@angular-devkit/build-angular:browser` builder, terser
is used as a second phase optimizer. The terser configuration previously set its `ecma` option
to `es2020` due to all officially supported browsers supporting the version. However, it is
possible to add browsers to the browserslist configuration that are not officially supported
that still may work but do not support es2020 syntax features. By setting the terser `ecma`
option to `es2015`, terser will not turn existing syntax into newer syntax features that might
be unsupported. Terser will also not downlevel any code based on this option.

Fixes angular#24347
@clydin clydin added the target: patch This PR is targeted for the next patch release label Nov 30, 2022
@clydin clydin requested a review from alan-agius4 November 30, 2022 18:39
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Nov 30, 2022
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 30, 2022
@angular-robot angular-robot bot merged commit ef99a68 into angular:main Dec 1, 2022
@clydin clydin deleted the webpack/terser-es2020-fix branch December 1, 2022 11:33
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Current 15 version breaks compatibility with Firefox 60 (included in browserslist) and optimization true
2 participants