Skip to content

Commit

Permalink
fix(@ngtools/webpack): add a simple sanity check for preventing wrong…
Browse files Browse the repository at this point in the history
… styleUrls

Fixes #8560.
  • Loading branch information
hansl committed Nov 23, 2017
1 parent 233338f commit e3e04c5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/@ngtools/webpack/src/resource_loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ export class WebpackResourceLoader {
throw new Error('WebpackResourceLoader cannot be used without parentCompilation');
}

// Simple sanity check.
if (filePath.match(/\.[jt]s$/)) {
return Promise.reject('Cannot use a JavaScript or TypeScript file for styleUrl.');
}

const compilerName = `compiler(${this._uniqueId++})`;
const outputOptions = { filename: filePath };
const relativePath = path.relative(this._context || '', filePath);
Expand Down

0 comments on commit e3e04c5

Please sign in to comment.