Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): add es2015 exports package condit…
Browse files Browse the repository at this point in the history
…ion to browser-esbuild

The `es2015` exports package condition is used by `rxjs` to allow bundlers to use the ES2015-based
ESM code instead of the default of ES5-based ESM code. The ES5-based ESM code is larger in size
and harder to optimize due to the downlevelled classes. This change results in a ~5Kb size reduction
for the main bundle of a new application (129920 -> 124183).

(cherry picked from commit cba5f6c)
  • Loading branch information
clydin authored and dgp1130 committed May 26, 2022
1 parent 5365932 commit 2adf252
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ async function bundleCode(
assetNames: outputNames.media,
target: 'es2020',
mainFields: ['es2020', 'browser', 'module', 'main'],
conditions: ['es2020', 'module'],
conditions: ['es2020', 'es2015', 'module'],
resolveExtensions: ['.ts', '.tsx', '.mjs', '.js'],
logLevel: options.verbose ? 'debug' : 'silent',
metafile: true,
Expand Down

0 comments on commit 2adf252

Please sign in to comment.