Skip to content

Commit 2b4beac

Browse files
devversionclydin
authored andcommitted
fix(@angular-devkit/build-angular): experimental esbuild pipeline, add 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)
1 parent 8e55424 commit 2b4beac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/angular_devkit/build_angular/src/tools/esbuild/application-code-bundle.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ export function createCodeBundleOptions(
4747
assetNames: outputNames.media,
4848
target,
4949
supported: getFeatureSupport(target),
50-
mainFields: ['es2020', 'browser', 'module', 'main'],
50+
// Note: `es2015` is needed for RxJS v6. If not specified, `module` would
51+
// match and the ES5 distribution would be bundled and ends up breaking at
52+
// runtime with the RxJS testing library.
53+
// More details: https://github.com/angular/angular-cli/issues/25405.
54+
mainFields: ['es2020', 'es2015', 'browser', 'module', 'main'],
5155
conditions: ['es2020', 'es2015', 'module'],
5256
resolveExtensions: ['.ts', '.tsx', '.mjs', '.js'],
5357
metafile: true,

0 commit comments

Comments
 (0)