Skip to content

Commit

Permalink
perf(@angular-devkit/build-angular): skip FESM2015 from async trans…
Browse files Browse the repository at this point in the history
…formation

Skip  `async` transformation when the path matches a FESM2015 entrypoint.  Ng-packagr doesn't allow changing the script target for entry-points which makes this possible https://github.com/ng-packagr/ng-packagr/blob/master/src/lib/ng-package/entry-point/compile-ngc.transform.ts#L48

This is important to reduce greatly the cold build performance overhead when targeting ES2017+
  • Loading branch information
alan-agius4 committed Mar 12, 2021
1 parent 9714aa9 commit 63a2dbb
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default custom<AngularCustomOptions>(() => {
// TypeScript files will have already been downlevelled
customOptions.forceES5 = !/\.tsx?$/.test(this.resourcePath);
} else if (esTarget >= ScriptTarget.ES2017) {
customOptions.forceAsyncTransformation = source.includes('async');
customOptions.forceAsyncTransformation = !/[\\\/]fesm2015[\\\/]/.test(this.resourcePath) && source.includes('async');
}
shouldProcess ||= customOptions.forceAsyncTransformation || customOptions.forceES5;
}
Expand Down

0 comments on commit 63a2dbb

Please sign in to comment.