-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Application code is not being 'up-targeted' to ES2022 despite warning message from CLI #25290
Comments
This is working as expected. TLDR; it’s the browerslist configuration that controls which ECMA version is outputted at the end not the TypeScript target. The TypeScript output is indeed always transpilled to ES2022, later the outputted JS together with all the node packages are passed to Babel and based on the desired browser support configured (if not configured the default list of supported browsers by Angular https://angular.io/guide/browser-support is used) individual ES features are downlevelled. |
Thanks for the quick reply. But I believe something is still amiss. I literally ONLY changed In Angular 16 if I have Your commit included the following, which clearly mirrors the intent of the warning message. But it simply doesn't seem to be taking effect. My code is still being compiled to the original target.
I'm good with my own project now obviously, but I think there's scope either for an clearer message or perhaps this is a subtle regression. I got caught in my own app when I discovered all my spreads had become |
There appeared to be indeed an issue which should be addressed in #25296. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
build, serve
Is this a regression?
The previous version in which this bug was not present was
No response
Description
The following message is shown by the CLI if changing
target
to ES2015 for Angular 15 +However code running in the browser using
??
(a pre ES2022 feature) is still transpiled, even without any changes to Browserslist.Either there is a bug, or the message needs to be rewritten to be clearer as to what is really happening.
See also: commit for #23936 by @alan-agius4
Minimal Reproduction
// 16.0.3
Run
ng new project-name
Update tsconfig.json to
Add the following line of code to AppComponent.ts:
Run
ng serve
View
main.js
in browser and observe that the code has been transpiled:With
target
set toES2022
the??
remains:Exception or Error
Your Environment
Anything else relevant?
This is similar to #24435, but that is related to
useDefineForClassFields
and nottarget
.See my answer here: https://stackoverflow.com/questions/75047760/typescript-target-warnings-after-angular-15-update/76369523#76369523
The main reason this is an issue is because you can observe your user code is transpiled, but Angular / vendor code is not - which may lead to a false sense of security if needing to target older browsers.
The text was updated successfully, but these errors were encountered: