From d3c08e74f626c75a262535d4e78c251f97855d02 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 4 Dec 2018 12:23:49 +0100 Subject: [PATCH] fix(compiler-cli): flatModuleIndex files not generated on windows with multiple input files (#27200) * Currently when building a `ng_module` with Bazel and having the flat module id option set, the flat module files are not being generated because `@angular/compiler-cli` does not properly determine the entry-point file. Note that this logic is not necessarily specific to Bazel and the same problem can happen without Bazel if multiple TypeScript input files are specified while the `flatModuleIndex` option has been enabled. PR Close #27200 --- packages/compiler-cli/src/metadata/bundle_index_host.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/compiler-cli/src/metadata/bundle_index_host.ts b/packages/compiler-cli/src/metadata/bundle_index_host.ts index 17c5bda206..489c32c4db 100644 --- a/packages/compiler-cli/src/metadata/bundle_index_host.ts +++ b/packages/compiler-cli/src/metadata/bundle_index_host.ts @@ -71,8 +71,10 @@ export function createBundleIndexHost( indexFile = files[0]; } else { for (const f of files) { - // Assume the shortest file path called index.ts is the entry point - if (f.endsWith(path.sep + 'index.ts')) { + // Assume the shortest file path called index.ts is the entry point. Note that we + // need to use the posix path delimiter here because TypeScript internally only + // passes posix paths. + if (f.endsWith('/index.ts')) { if (!indexFile || indexFile.length > f.length) { indexFile = f; }