Skip to content
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

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

Closed
argentum388 opened this issue Nov 30, 2022 · 2 comments · Fixed by #24353
Assignees

Comments

@argentum388
Copy link

Which @angular/* package(s) are the source of the bug?

compiler-cli, compiler

Is this a regression?

Yes

Description

Despite of including old Firefox browser versions (60-78) to browserslist application bundle throws an error in browser console

"SyntaxError: expected expression, got '?'[Learn More] vendor.js"

Note! This bug is only reproduced with optimization.scripts: true in configuration

It seems optimization procedures add to bundle Logical nullish assignment operator "?? "which Firefox 60-78 don't support

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

SyntaxError: expected expression, got '?'[Learn More]  vendor.js

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 15.0.1
Node: 14.20.1
Package Manager: npm 6.14.17
OS: linux x64

Angular: 15.0.1
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1500.1
@angular-devkit/build-angular   15.0.1
@angular-devkit/core            15.0.1
@angular-devkit/schematics      15.0.1
@angular/cdk                    15.0.0
@angular/material               15.0.0
@schematics/angular             15.0.1
rxjs                            7.5.7
typescript                      4.8.4

Anything else?

.browserslistrc

Firefox > 59

@JoostK JoostK transferred this issue from angular/angular Nov 30, 2022
@alan-agius4
Copy link
Collaborator

Officially Firefox 60 is not supported by Angular,
See: https://angular.io/guide/browser-support#browser-support for a list of supported browsers.

However there might be something going on here. To look into this further we'd require a minimal reproduction.

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

@alan-agius4 alan-agius4 added the needs: repro steps We cannot reproduce the issue with the information given label Nov 30, 2022
@alan-agius4 alan-agius4 assigned alan-agius4 and clydin and unassigned clydin and alan-agius4 Nov 30, 2022
clydin added a commit to clydin/angular-cli that referenced this issue Nov 30, 2022
…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 removed the needs: repro steps We cannot reproduce the issue with the information given label Nov 30, 2022
angular-robot bot pushed a commit that referenced this issue Dec 1, 2022
…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 #24347
angular-robot bot pushed a commit that referenced this issue Dec 1, 2022
…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 #24347

(cherry picked from commit ef99a68)
@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
None yet
Projects
None yet
3 participants