Skip to content

Commit 18baeab

Browse files
committed
fix(@ngtools/webpack): resolve the filename of ALL sourcemaps
Before only the first was replaced, which can be wrong in certain files.
1 parent 082c570 commit 18baeab

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/@ngtools/webpack/src/loader.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,9 @@ export function ngcLoader(this: LoaderContext & { _compilation: any }, source: s
575575
result.outputText = result.outputText.replace(sourceMappingUrlRe, '');
576576
// Set the map source to use the full path of the file.
577577
const sourceMap = JSON.parse(result.sourceMap);
578-
sourceMap.sources[0] = sourceFileName;
578+
sourceMap.sources = sourceMap.sources.map((fileName: string) => {
579+
return path.join(path.dirname(sourceFileName), fileName);
580+
});
579581
result.sourceMap = JSON.stringify(sourceMap);
580582
}
581583

0 commit comments

Comments
 (0)