Option to do not override "target" and "useDefineForClassFields"
See original GitHub issueCommand
build, serve
Description
There are reasons why you’ve added this warning:
TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browerslist configuration. For more information, see https://github.com/browserslist/browserslist
To control ECMA version and features use the Browerslist configuration
There is no way to define target
and useDefineForClassFields
in the Browerslist configuration.
Please provide some option to skip target
and useDefineForClassFields
overriding - some projects are not ready for ES2022 and they are too big to modify overnight (or in a few weeks) to be compatible with ES2022, although they are still compatible with Angular 15 itself.
Describe the solution you’d like
Just quick ideas:
--keep-target-value --keep-use-defined-value
and
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
"options": {
"keepTargetValue": true,
"keepUseDefinedValue": true
}
}
}
Describe alternatives you’ve considered
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Breaking change to default useDefineForClassFields to true ...
Bug Report In some contexts (I'm not sure exactly which, but "target": "esnext" does it) useDefineForClassFields now defaults to true. This is a...
Read more >TSConfig Reference - Docs on every TSConfig option
The configuration from the base file are loaded first, then overridden by those in the inheriting config file. All relative paths found in...
Read more >Typescript Inheritance: Expanding base class object property
If your compiler options don't enable --useDefineForClassFields (and notice that if you make --target new enough it will be automatically ...
Read more >Content Types - ESBuild
Newer syntax may not be supported by older browsers, however, so you may want to configure the target option to tell esbuild to...
Read more >TypeScript configuration - Angular
The TypeScript and Angular have a wide range of options which can be used to ... You don't need to do anything to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
FWIW, one good reason to be able to lock to a specific target version is that some features may technically be supported by a browser but not be optimized. For example, in one code base I maintain I had to lock the target below ES2018 as object spread in Chrome is so slow it was showing performance degradation in our app perf tests: https://bugs.chromium.org/p/v8/issues/detail?id=10763
@Splaktar, yeah thanks for pointed that out