Skip to content

Commit 8899fb9

Browse files
dgp1130alan-agius4
authored andcommitted
fix(@ngtools/webpack): skip transforming empty inline styles in Webpack JIT compilations
Empty styles break the Webpack resource loader / PostCSS and generate an error. Fortunately there's no work to be done there, so we can just skip it and leave the empty string. (cherry picked from commit 7b02161)
1 parent e259c1f commit 8899fb9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/ngtools/webpack/src/transformers/replace_resources.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ function transformInlineStyleLiteral(
236236
return node;
237237
}
238238

239+
// Don't transform empty strings as PostCSS will choke on them. No work to do anyways.
240+
if (node.text === '') {
241+
return node;
242+
}
243+
239244
if (!isInlineStyle) {
240245
const url = getResourceUrl(node);
241246

0 commit comments

Comments
 (0)