@@ -36,7 +36,11 @@ export class TestingArchitectHost implements ArchitectHost {
36
36
this . _builderMap . set ( builderName , { builderName, description, optionSchema } ) ;
37
37
}
38
38
async addBuilderFromPackage ( packageName : string ) {
39
- const packageJson = await import ( packageName + '/package.json' ) ;
39
+ // f1 const is a temporary workaround for a TS bug with UMDs.
40
+ // See microsoft/TypeScript#36780. Should be removed when
41
+ // https://github.com/bazelbuild/rules_typescript/pull/492 goes in.
42
+ const f1 = packageName + '/package.json' ;
43
+ const packageJson = await import ( f1 ) ;
40
44
if ( ! ( 'builders' in packageJson ) ) {
41
45
throw new Error ( 'Invalid package.json, builders key not found.' ) ;
42
46
}
@@ -56,8 +60,13 @@ export class TestingArchitectHost implements ArchitectHost {
56
60
const b = builders [ builderName ] ;
57
61
// TODO: remove this check as v1 is not supported anymore.
58
62
if ( ! b . implementation ) { continue ; }
59
- const handler = ( await import ( builderJsonPath + '/../' + b . implementation ) ) . default ;
60
- const optionsSchema = await import ( builderJsonPath + '/../' + b . schema ) ;
63
+ // f2 and f3 consts are a temporary workaround for a TS bug with UMDs.
64
+ // See microsoft/TypeScript#36780. Should be removed when
65
+ // https://github.com/bazelbuild/rules_typescript/pull/492 goes in.
66
+ const f2 = builderJsonPath + '/../' + b . implementation ;
67
+ const handler = ( await import ( f2 ) ) . default ;
68
+ const f3 = builderJsonPath + '/../' + b . schema ;
69
+ const optionsSchema = await import ( f3 ) ;
61
70
this . addBuilder ( `${ packageJson . name } :${ builderName } ` , handler , b . description , optionsSchema ) ;
62
71
}
63
72
}
0 commit comments