question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to do not override "target" and "useDefineForClassFields"

See original GitHub issue

Command

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:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mgolcommented, Oct 5, 2022

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

1reaction
alan-agius4commented, Oct 5, 2022

@Splaktar, yeah thanks for pointed that out

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found