diff --git a/packages/compiler-cli/src/ngtsc/shims/src/factory_generator.ts b/packages/compiler-cli/src/ngtsc/shims/src/factory_generator.ts index d59656a443..c32a288ca3 100644 --- a/packages/compiler-cli/src/ngtsc/shims/src/factory_generator.ts +++ b/packages/compiler-cli/src/ngtsc/shims/src/factory_generator.ts @@ -10,6 +10,7 @@ import * as path from 'path'; import * as ts from 'typescript'; import {ImportRewriter} from '../../imports'; +import {normalizeSeparators} from '../../util/src/path'; import {isNonDeclarationTsPath} from '../../util/src/typescript'; import {ShimGenerator} from './host'; @@ -89,6 +90,7 @@ export class FactoryGenerator implements ShimGenerator { static forRootFiles(files: ReadonlyArray): FactoryGenerator { const map = new Map(); files.filter(sourceFile => isNonDeclarationTsPath(sourceFile)) + .map(sourceFile => normalizeSeparators(sourceFile)) .forEach(sourceFile => map.set(sourceFile.replace(/\.ts$/, '.ngfactory.ts'), sourceFile)); return new FactoryGenerator(map); } diff --git a/packages/compiler-cli/src/ngtsc/shims/src/summary_generator.ts b/packages/compiler-cli/src/ngtsc/shims/src/summary_generator.ts index fe2b36461d..ef14fae7b7 100644 --- a/packages/compiler-cli/src/ngtsc/shims/src/summary_generator.ts +++ b/packages/compiler-cli/src/ngtsc/shims/src/summary_generator.ts @@ -8,6 +8,7 @@ import * as ts from 'typescript'; +import {normalizeSeparators} from '../../util/src/path'; import {isNonDeclarationTsPath} from '../../util/src/typescript'; import {ShimGenerator} from './host'; @@ -64,6 +65,7 @@ export class SummaryGenerator implements ShimGenerator { static forRootFiles(files: ReadonlyArray): SummaryGenerator { const map = new Map(); files.filter(sourceFile => isNonDeclarationTsPath(sourceFile)) + .map(sourceFile => normalizeSeparators(sourceFile)) .forEach(sourceFile => map.set(sourceFile.replace(/\.ts$/, '.ngsummary.ts'), sourceFile)); return new SummaryGenerator(map); } diff --git a/packages/compiler-cli/src/ngtsc/util/src/path.ts b/packages/compiler-cli/src/ngtsc/util/src/path.ts index 4c5d11c55f..fc8300f017 100644 --- a/packages/compiler-cli/src/ngtsc/util/src/path.ts +++ b/packages/compiler-cli/src/ngtsc/util/src/path.ts @@ -26,3 +26,8 @@ export function relativePathBetween(from: string, to: string): string|null { return relative; } + +export function normalizeSeparators(path: string): string { + // TODO: normalize path only for OS that need it. + return path.replace(/\\/g, '/'); +}