Skip to content

Commit 4b03726

Browse files
committed
fixup! fix(@angular/build): use component file path in inline stylesheet diagnostic locations
1 parent a0cf5a5 commit 4b03726

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

‎packages/angular/build/src/tools/esbuild/angular/component-stylesheets.ts‎

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -180,27 +180,19 @@ export class ComponentStylesheetBundler {
180180
const watchFile = path.isAbsolute(filename)
181181
? filename
182182
: path.join(this.options.workspaceRoot, filename);
183-
if (result.errors) {
184-
for (const error of result.errors) {
185-
if (error.location?.file.startsWith('angular:styles/component:')) {
186-
error.location.file = filename;
183+
for (const message of [...(result.errors ?? []), ...(result.warnings ?? [])]) {
184+
if (message.location?.file?.startsWith('angular:styles/component:')) {
185+
message.location.file = filename;
186+
if (result.errors) {
187187
bundlerContext.watchFiles.add(watchFile);
188188
}
189-
for (const note of error.notes) {
190-
if (note.location?.file.startsWith('angular:styles/component:')) {
191-
note.location.file = filename;
192-
bundlerContext.watchFiles.add(watchFile);
193-
}
194-
}
195189
}
196-
}
197-
for (const warning of result.warnings) {
198-
if (warning.location?.file.startsWith('angular:styles/component:')) {
199-
warning.location.file = filename;
200-
}
201-
for (const note of warning.notes) {
202-
if (note.location?.file.startsWith('angular:styles/component:')) {
190+
for (const note of message.notes ?? []) {
191+
if (note.location?.file?.startsWith('angular:styles/component:')) {
203192
note.location.file = filename;
193+
if (result.errors) {
194+
bundlerContext.watchFiles.add(watchFile);
195+
}
204196
}
205197
}
206198
}

0 commit comments

Comments
 (0)