Skip to content

Commit 3e35167

Browse files
committedMar 10, 2025
fix(@angular/build): handle postcss compilation errors gracefully
Improves error handling in the PostCSS compilation process to prevent crashes and allow recovery. Closes #29789
1 parent 596b9ae commit 3e35167

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed
 

‎packages/angular/build/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { readFile } from 'node:fs/promises';
1212
import { extname } from 'node:path';
1313
import type { Options } from 'sass';
1414
import { glob } from 'tinyglobby';
15+
import { assertIsError } from '../../../utils/error';
1516
import type { PostcssConfiguration } from '../../../utils/postcss-configuration';
1617
import { LoadResultCache, createCachedLoad } from '../load-result-cache';
1718

@@ -422,8 +423,16 @@ async function compileString(
422423
},
423424
],
424425
};
425-
}
426+
} else {
427+
assertIsError(error);
426428

427-
throw error;
429+
return {
430+
errors: [
431+
{
432+
text: error.message,
433+
},
434+
],
435+
};
436+
}
428437
}
429438
}

0 commit comments

Comments
 (0)
Failed to load comments.