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

Missing Automatic Polyfills as Described in Docs #56020

Closed
1 task done
Char2sGu opened this issue May 23, 2024 · 4 comments
Closed
1 task done

Missing Automatic Polyfills as Described in Docs #56020

Char2sGu opened this issue May 23, 2024 · 4 comments
Labels
area: adev Angular.dev documentation area: docs Related to the documentation good first issue An issue that is suitable for first-time contributors; often a documentation issue. help wanted An issue that is suitable for a community contributor (based on its complexity/scope).
Milestone

Comments

@Char2sGu
Copy link
Contributor

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

v8?

Description

As described at https://angular.dev/tools/cli/build#configuring-browser-compatibility, polyfills should be automatically added based on the browserslist configuration:

The Angular CLI uses Browserslist to ensure compatibility with different browser versions. Depending on supported browsers, Angular will automatically polyfill and transform certain JavaScript and CSS features to ensure the built application does not use a feature which has not been implemented by a supported browser.

Angular V8 used to add core-js polyfills automatically according to StackOverflow discussions at https://stackoverflow.com/questions/56892243/is-not-core-js-needed-anymore:

The difference with core-js in ng8 is that, since the CLI is handling polyfills, core-js is a dependency of the CLI. So even if you uninstall core-js as part of upgrading to ng8, you'll see it's still in your node_modules folder, but you won't have to manage which version is installed.

However, currently no core-js dependencies are found and also no core-js polyfills are automatically added. Angular CLI uses @babel/preset-env when building Angular applicaitons, which has built-in support of automatic polyfilling based on core-js, but this feature is not enabled:

https://github.com/angular/angular-cli/blob/c7205ea182f6c38231ce8fe8ab358dc7eab58d65/packages/angular_devkit/build_angular/src/tools/babel/presets/application.ts#L215-L224

Minimal Reproduction

N/A

Exception or Error

No response

Your Environment

Angular CLI: 17.3.0
Node: 18.19.0
Package Manager: npm 10.2.3
OS: linux x64

Angular: 17.3.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... elements, forms, localize, material, platform-browser
... router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.0
@angular-devkit/build-angular   17.3.0
@angular-devkit/core            17.3.0
@angular-devkit/schematics      17.3.0
@schematics/angular             17.3.0
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.2

Anything else relevant?

No response

@alan-agius4
Copy link
Contributor

The docs are incorrect here as the Angular CLI does not add polyfills.

See: angular/angular-cli#27510

@alan-agius4 alan-agius4 transferred this issue from angular/angular-cli May 23, 2024
@alan-agius4 alan-agius4 added help wanted An issue that is suitable for a community contributor (based on its complexity/scope). good first issue An issue that is suitable for first-time contributors; often a documentation issue. area: adev Angular.dev documentation area: docs Related to the documentation labels May 23, 2024
@ngbot ngbot bot modified the milestone: needsTriage May 23, 2024
@Char2sGu
Copy link
Contributor Author

Alright then. I understand the design concerns, although do not fully agree.
Did any previous Angular version ever support automatic polyfills? According to historical community discussions, automatic polyfilling was once supported.

@alan-agius4
Copy link
Contributor

No we never supported automatic polyfilling.

@Char2sGu Char2sGu closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2024
@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 Jun 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: adev Angular.dev documentation area: docs Related to the documentation good first issue An issue that is suitable for first-time contributors; often a documentation issue. help wanted An issue that is suitable for a community contributor (based on its complexity/scope).
Projects
None yet
Development

No branches or pull requests

2 participants