Skip to content

Commit 9b0bb9b

Browse files
alan-agius4Keen Yee Liau
authored and
Keen Yee Liau
committed
fix(@ngtools/webpack): gracefully show error when compiling broken component styles
Fixes angular#15240
1 parent eacf1b7 commit 9b0bb9b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/resource_loader.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ export class WebpackResourceLoader {
9999
// Compile and return a promise
100100
return new Promise((resolve, reject) => {
101101
childCompiler.compile((err: Error, childCompilation: any) => {
102+
if (err) {
103+
reject(err);
104+
105+
return;
106+
}
107+
102108
// Resolve / reject the promise
103109
const { warnings, errors } = childCompilation;
104110

@@ -114,8 +120,6 @@ export class WebpackResourceLoader {
114120
.join('\n');
115121

116122
reject(new Error('Child compilation failed:\n' + errorDetails));
117-
} else if (err) {
118-
reject(err);
119123
} else {
120124
Object.keys(childCompilation.assets).forEach(assetName => {
121125
// Add all new assets to the parent compilation, with the exception of

0 commit comments

Comments
 (0)