Skip to content

Commit 52356a3

Browse files
committed
fix(@ngtools/webpack): add a simple sanity check for preventing wrong styleUrls
Fixes #8560.
1 parent 4805245 commit 52356a3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/@ngtools/webpack/src/resource_loader.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ export class WebpackResourceLoader {
3636
throw new Error('WebpackResourceLoader cannot be used without parentCompilation');
3737
}
3838

39+
// Simple sanity check.
40+
if (filePath.match(/\.[jt]s$/)) {
41+
return Promise.reject('Cannot use a JavaScript or TypeScript file for styleUrl.');
42+
}
43+
3944
const compilerName = `compiler(${this._uniqueId++})`;
4045
const outputOptions = { filename: filePath };
4146
const relativePath = path.relative(this._context || '', filePath);

0 commit comments

Comments
 (0)