fix(bazel): improve error message for missing assets (#22096)

fixes #22095

PR Close #22096
This commit is contained in:
Alex Eagle
2018-02-08 08:36:18 -08:00
committed by Miško Hevery
parent de561f36e1
commit c5ec8d952a
2 changed files with 12 additions and 1 deletions

View File

@ -202,6 +202,12 @@ export function compile({allowNonHermeticReads, allDepsCompiledWithBazel = true,
return path.resolve(bazelBin, workspaceRelative) + '.d.ts';
};
}
// Patch a property on the ngHost that allows the resourceNameToModuleName function to
// report better errors.
(ngHost as any).reportMissingResource = (resourceName: string) => {
console.error(`\nAsset not found:\n ${resourceName}`);
console.error('Check that it\'s included in the `assets` attribute of the `ng_module` rule.\n');
};
const emitCallback: ng.TsEmitCallback = ({
program,