-
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
feat(@angular-devkit/build-angular): use Browserslist to determine ECMA output #23936
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alan-agius4
force-pushed
the
es2022-projects
branch
from
September 20, 2022 08:57
79c6aed
to
cf4e01e
Compare
alan-agius4
added
the
target: major
This PR is targeted for the next major release
label
Sep 20, 2022
alan-agius4
force-pushed
the
es2022-projects
branch
6 times, most recently
from
September 20, 2022 10:37
554036b
to
1d91881
Compare
alan-agius4
force-pushed
the
es2022-projects
branch
2 times, most recently
from
September 20, 2022 11:17
cbb2c19
to
8ddfc6d
Compare
alan-agius4
added
the
action: review
The PR is still awaiting reviews from at least one requested reviewer
label
Sep 20, 2022
alan-agius4
force-pushed
the
es2022-projects
branch
2 times, most recently
from
September 20, 2022 16:33
04090fb
to
0769b14
Compare
clydin
reviewed
Sep 20, 2022
packages/angular_devkit/build_angular/src/builders/browser-esbuild/compiler-plugin.ts
Outdated
Show resolved
Hide resolved
packages/angular_devkit/build_angular/src/builders/browser-esbuild/compiler-plugin.ts
Outdated
Show resolved
Hide resolved
packages/angular_devkit/build_angular/src/webpack/plugins/typescript.ts
Outdated
Show resolved
Hide resolved
alan-agius4
force-pushed
the
es2022-projects
branch
from
September 21, 2022 07:12
0769b14
to
4ff60e1
Compare
clydin
reviewed
Sep 21, 2022
…MA output With this change we reduce the reliance on the TypeScript target compiler option to output a certain ECMA version. Instead we now use the browsers that are configured in the Browserslist configuration to determine which ECMA features and version are needed. This is done by passing the transpiled TypeScript to Babel preset-env. **Note about useDefineForClassFields**: while setting this to `false` will output JavaScript which is not spec compliant, this is needed because TypeScript introduced class fields many years before it was ratified in TC39. The latest version of the spec have a different runtime behavior to TypeScript’s implementation but the same syntax. Therefore, we opt-out from using upcoming ECMA runtime behavior to better support the ECO system and libraries that depend on the non spec compliant output. One of biggest case is usages of the deprecated `@Effect` decorator by NGRX and potentially other existing code as well which otherwise would cause runtime failures. Dropping `useDefineForClassFields` will be considered in a future major releases. For more information see: microsoft/TypeScript#45995. BREAKING CHANGE: Internally the Angular CLI now always set the TypeScript `target` to `ES2022` and `useDefineForClassFields` to `false` unless the target is set to `ES2022` or later in the TypeScript configuration. To control ECMA version and features use the Browerslist configuration.
This commit updates the browsers versions to reflect the what's currently supported.
alan-agius4
force-pushed
the
es2022-projects
branch
from
September 21, 2022 14:34
4ff60e1
to
b15441a
Compare
clydin
approved these changes
Sep 21, 2022
alan-agius4
added
action: merge
The PR is ready for merge by the caretaker
and removed
action: review
The PR is still awaiting reviews from at least one requested reviewer
labels
Sep 21, 2022
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
action: merge
The PR is ready for merge by the caretaker
flag: breaking change
target: major
This PR is targeted for the next major release
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this change we reduce the reliance on the TypeScript target compiler option to output a certain ECMA version. Instead we now use the browsers that are configured in the Browserslist configuration to determine which ECMA features and version are needed. This is done by passing the transpiled TypeScript to Babel preset-env.
Note about useDefineForClassFields: while setting this to
false
will output JavaScript which is not spec compliant, this is needed because TypeScript introduced class fields many years before it was ratified in TC39. The latest version of the spec have a different runtime behavior to TypeScript’s implementation but the same syntax. Therefore, we opt-out from using upcoming ECMA runtime behavior to better support the ECO system and libraries that depend on the non spec compliant output. One of biggest case is usages of the deprecated@Effect
decorator by NGRX and potentially other existing code as well which otherwise would cause runtime failures. DroppinguseDefineForClassFields
will be considered in a future major releases. For more information see: microsoft/TypeScript#45995.BREAKING CHANGE: Internally the Angular CLI now always set the TypeScript
target
toES2022
anduseDefineForClassFields
tofalse
unless the target is set toES2022
or later in the TypeScript configuration. To control ECMA version and features use the Browerslist configuration.