Skip to content

Commit 5bd0335

Browse files
clydindgp1130
authored andcommitted
fix(@angular-devkit/build-angular): correct esbuild builder global stylesheet sourcemap URL
The sourcemap URL in the output CSS files for global stylesheets is now correctly updated to reflect the name of the global stylesheet output file and not the internal `stdin` virtual file name. (cherry picked from commit b647d80)
1 parent d976405 commit 5bd0335

File tree

1 file changed

+6
-1
lines changed
  • packages/angular_devkit/build_angular/src/builders/browser-esbuild

1 file changed

+6
-1
lines changed

packages/angular_devkit/build_angular/src/builders/browser-esbuild/index.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,15 @@ async function bundleGlobalStylesheets(
386386
// with the actual name of the global style and the leading directory separator must
387387
// also be removed to make the path relative.
388388
const sheetPath = sheetResult.path.replace('stdin', name);
389-
outputFiles.push(createOutputFileFromText(sheetPath, sheetResult.contents));
389+
let sheetContents = sheetResult.contents;
390390
if (sheetResult.map) {
391391
outputFiles.push(createOutputFileFromText(sheetPath + '.map', sheetResult.map));
392+
sheetContents = sheetContents.replace(
393+
'sourceMappingURL=stdin.css.map',
394+
`sourceMappingURL=${name}.css.map`,
395+
);
392396
}
397+
outputFiles.push(createOutputFileFromText(sheetPath, sheetContents));
393398

394399
if (!noInjectNames.includes(name)) {
395400
initialFiles.push({

0 commit comments

Comments
 (0)