Skip to content

Commit 7f6e86c

Browse files
JSMikeclaude
andcommitted
refactor(@angular/build): use async file read and warn on missing sourcemap
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7b63b23 commit 7f6e86c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/angular/build/src/tools/esbuild/javascript-transformer-worker.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,18 @@ async function transformWithBabel(
107107
if (externalMapMatch) {
108108
const mapPath = path.resolve(path.dirname(filename), externalMapMatch[1]);
109109
try {
110-
const mapContent = fs.readFileSync(mapPath, 'utf-8');
110+
const mapContent = await fs.promises.readFile(mapPath, 'utf-8');
111111
const inlineMap = Buffer.from(mapContent).toString('base64');
112112
return data.replace(
113113
/^\/\/# sourceMappingURL=[^\r\n]*/m,
114114
`//# sourceMappingURL=data:application/json;charset=utf-8;base64,${inlineMap}`,
115115
);
116-
} catch {
116+
} catch (error) {
117117
// Map file not readable; return data with the original external reference
118+
// eslint-disable-next-line no-console
119+
console.warn(
120+
`Unable to inline sourcemap for '${filename}': ${error instanceof Error ? error.message : error}`,
121+
);
118122
}
119123
}
120124

0 commit comments

Comments
 (0)