From 767f0fffdc797318f11d90470cfc3f33174dec58 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Fri, 23 Apr 2021 15:12:47 -0400 Subject: [PATCH] perf(@angular-devkit/build-angular): avoid async downlevel for known ES2015 code Library code inside fesm2015/esm2015/_esm2015 directories has been downlevelled to ES2015 which will not have native async/await. As a result, code from those directories can be skipped from the additional checks as well as the downlevel processing. RxJS uses the `_esm2015` directory naming convention. --- .../angular_devkit/build_angular/src/babel/webpack-loader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/angular_devkit/build_angular/src/babel/webpack-loader.ts b/packages/angular_devkit/build_angular/src/babel/webpack-loader.ts index 24624cf7cccd..c89472af597f 100644 --- a/packages/angular_devkit/build_angular/src/babel/webpack-loader.ts +++ b/packages/angular_devkit/build_angular/src/babel/webpack-loader.ts @@ -66,7 +66,7 @@ export default custom(() => { // TypeScript files will have already been downlevelled customOptions.forceES5 = !/\.tsx?$/.test(this.resourcePath); } else if (esTarget >= ScriptTarget.ES2017) { - customOptions.forceAsyncTransformation = !/[\\\/]fesm2015[\\\/]/.test(this.resourcePath) && source.includes('async'); + customOptions.forceAsyncTransformation = !/[\\\/][_f]?esm2015[\\\/]/.test(this.resourcePath) && source.includes('async'); } shouldProcess ||= customOptions.forceAsyncTransformation || customOptions.forceES5; }