From f79909296fc1c7116beb6996962bbdad1e0c5b75 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Thu, 5 Mar 2020 15:24:09 +0000 Subject: [PATCH] fix: temporary workaround for TS bug with UMDs The TS bug is https://github.com/microsoft/TypeScript/issues/36780. The workaround is needed because `ts_library` emits UMDs currently. This will change with https://github.com/bazelbuild/rules_typescript/pull/492 and https://github.com/bazelbuild/rules_nodejs/pull/1687. --- .../architect/node/node-modules-architect-host.ts | 3 ++- .../architect/testing/testing-architect-host.ts | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/angular_devkit/architect/node/node-modules-architect-host.ts b/packages/angular_devkit/architect/node/node-modules-architect-host.ts index 9e78000ea783..7f7138d00805 100644 --- a/packages/angular_devkit/architect/node/node-modules-architect-host.ts +++ b/packages/angular_devkit/architect/node/node-modules-architect-host.ts @@ -143,7 +143,8 @@ export class WorkspaceNodeModulesArchitectHost implements ArchitectHost { - const builder = (await import(info.import)).default; + const f1 = info.import; + const builder = (await import(f1)).default; if (builder[BuilderSymbol]) { return builder; } diff --git a/packages/angular_devkit/architect/testing/testing-architect-host.ts b/packages/angular_devkit/architect/testing/testing-architect-host.ts index c7d901f3906b..c37c76f87e25 100644 --- a/packages/angular_devkit/architect/testing/testing-architect-host.ts +++ b/packages/angular_devkit/architect/testing/testing-architect-host.ts @@ -36,7 +36,8 @@ export class TestingArchitectHost implements ArchitectHost { this._builderMap.set(builderName, { builderName, description, optionSchema }); } async addBuilderFromPackage(packageName: string) { - const packageJson = await import(packageName + '/package.json'); + const f1 = packageName + '/package.json'; + const packageJson = await import(f1); if (!('builders' in packageJson)) { throw new Error('Invalid package.json, builders key not found.'); } @@ -56,8 +57,10 @@ export class TestingArchitectHost implements ArchitectHost { const b = builders[builderName]; // TODO: remove this check as v1 is not supported anymore. if (!b.implementation) { continue; } - const handler = (await import(builderJsonPath + '/../' + b.implementation)).default; - const optionsSchema = await import(builderJsonPath + '/../' + b.schema); + const f2 = builderJsonPath + '/../' + b.implementation; + const handler = (await import(f2)).default; + const f3 = builderJsonPath + '/../' + b.schema; + const optionsSchema = await import(f3); this.addBuilder(`${packageJson.name}:${builderName}`, handler, b.description, optionsSchema); } }