From ca1c430f30127c1abb061fba585b45195d5b62e5 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 4 Dec 2018 23:35:28 +0100 Subject: [PATCH] fix(compiler-cli): ngtsc shim files not being generated on case-insensitive platforms (#27466) Common insensitive platforms are `win32/win64` (see: [here](https://github.com/Microsoft/TypeScript/blob/3e4c5c95abd515eb9713b881d27ab3a93cc00461/src/compiler/sys.ts#L681-L682)) Currently when running `bazel build packages/core --define=compile=aot`, the `compiler-cli` will throw because it cannot find the `index.ngfactory.ts` file in the compiler host. This is because the shim host wrapper is not properly generating the requested `ngfactory` file. This happens because we call `getCanonicalFileName` that returns a path that is different to the actual program filenames that are used to construct a map of generated files. Since the generators always use the paths which are not "canonical" and pases them internally like that, we can just stop manually calling `getCanonicalFileName`. PR Close #27466 --- packages/compiler-cli/src/ngtsc/shims/src/host.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/compiler-cli/src/ngtsc/shims/src/host.ts b/packages/compiler-cli/src/ngtsc/shims/src/host.ts index 578ff10424..1c83b09939 100644 --- a/packages/compiler-cli/src/ngtsc/shims/src/host.ts +++ b/packages/compiler-cli/src/ngtsc/shims/src/host.ts @@ -53,10 +53,9 @@ export class GeneratedShimsHostWrapper implements ts.CompilerHost { fileName: string, languageVersion: ts.ScriptTarget, onError?: ((message: string) => void)|undefined, shouldCreateNewSourceFile?: boolean|undefined): ts.SourceFile|undefined { - const canonical = this.getCanonicalFileName(fileName); for (let i = 0; i < this.shimGenerators.length; i++) { const generator = this.shimGenerators[i]; - const originalFile = generator.getOriginalSourceOfShim(canonical); + const originalFile = generator.getOriginalSourceOfShim(fileName); if (originalFile !== null) { // This shim generator has recognized the filename being requested, and is now responsible // for generating its contents, based on the contents of the original file it has requested.