fix(compiler-cli): do not add references to files outside of rootDir (#19770)

References to resources (such as .css files) that are generated into
the `outDir` directory outside of `rootDir` would cause a spurious
compiler error about not being able to find a files that ends in
'.ngstyle.ts'.

Also fixed a minor issue in compiler error reporting

Fixes: #19765, #19767

PR Close #19770
This commit is contained in:
Chuck Jazdzewski
2017-10-17 16:10:15 -07:00
committed by Tobias Bosch
parent 3861ba2929
commit 25cbc98979
4 changed files with 46 additions and 3 deletions

View File

@ -113,7 +113,7 @@ export class AotCompiler {
compMeta.template !.styleUrls.forEach((styleUrl) => {
const normalizedUrl = this._host.resourceNameToFileName(styleUrl, file.fileName);
if (!normalizedUrl) {
throw new Error(`Couldn't resolve resource ${styleUrl} relative to ${file.fileName}`);
throw syntaxError(`Couldn't resolve resource ${styleUrl} relative to ${file.fileName}`);
}
const needsShim = (compMeta.template !.encapsulation ||
this._config.defaultEncapsulation) === ViewEncapsulation.Emulated;