Skip to content

Commit 03e8239

Browse files
authored
fix(nx-infra-plugin): normalize path separators in build-typescript executor on Windows (#32653)
1 parent 3a30989 commit 03e8239

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

  • packages/nx-infra-plugin/src/executors/build-typescript

packages/nx-infra-plugin/src/executors/build-typescript/executor.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,17 @@ async function resolveSourceFiles(
137137
return files;
138138
}
139139

140+
function replacePathPrefix(filePath: string, from: string, to: string): string {
141+
if (isWindowsOS()) {
142+
return normalizeGlobPathForWindows(filePath).replace(
143+
normalizeGlobPathForWindows(from),
144+
normalizeGlobPathForWindows(to),
145+
);
146+
}
147+
148+
return filePath.replace(from, to);
149+
}
150+
140151
function buildCompilerOptions(
141152
tsconfigContent: TsConfig,
142153
tsconfigPath: string,
@@ -178,7 +189,7 @@ async function emitWithAliasResolution(
178189
let finalContent = fileData;
179190

180191
if (aliasTranspileFunc && aliasPath) {
181-
const normalizedFilePath = filePath.replace(outDir, aliasPath);
192+
const normalizedFilePath = replacePathPrefix(filePath, outDir, aliasPath);
182193
finalContent = aliasTranspileFunc(normalizedFilePath, fileData);
183194
}
184195

0 commit comments

Comments
 (0)