Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): experimental esbuild pipeline, ad…
Browse files Browse the repository at this point in the history
…d `es2015` to main fields for RxJS v6 compatibility

Currently, for RxJS v6, no conditions are available, and the ESBuild
pipeline will select the ES5 distribution based on the `module` main
field. This is fine in most cases, but applications could benefit from
better optimization with the use of the ES2015 output + there are
certain code differences that currently would cause runtime breakages
when e.g. `rxjs/testing` is used.

See: #25405 for more details.

Fixes #25405.

(cherry picked from commit 9d9a668)
  • Loading branch information
devversion authored and clydin committed Jun 20, 2023
1 parent 8e55424 commit 2b4beac
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ export function createCodeBundleOptions(
assetNames: outputNames.media,
target,
supported: getFeatureSupport(target),
mainFields: ['es2020', 'browser', 'module', 'main'],
// Note: `es2015` is needed for RxJS v6. If not specified, `module` would
// match and the ES5 distribution would be bundled and ends up breaking at
// runtime with the RxJS testing library.
// More details: https://github.com/angular/angular-cli/issues/25405.
mainFields: ['es2020', 'es2015', 'browser', 'module', 'main'],
conditions: ['es2020', 'es2015', 'module'],
resolveExtensions: ['.ts', '.tsx', '.mjs', '.js'],
metafile: true,
Expand Down

0 comments on commit 2b4beac

Please sign in to comment.