fix: throw if global css file is not found in webpack context (#5186)

This commit is contained in:
Stanimira Vlaeva
2018-03-01 11:05:12 +02:00
committed by GitHub
parent 2704915384
commit 9ce08196f8

View File

@ -88,7 +88,12 @@ export function getCssFileName(): string {
}
export function loadAppCss(): void {
events.notify(<LoadAppCSSEventData>{ eventName: "loadAppCss", object: app, cssFile: getCssFileName() });
try {
events.notify(<LoadAppCSSEventData>{ eventName: "loadAppCss", object: app, cssFile: getCssFileName() });
} catch (e) {
throw new Error(`The file ${getCssFileName()} couldn't be loaded! ` +
`You may need to register it inside ./app/vendor.ts.`);
}
}
export function addCss(cssText: string): void {
@ -97,4 +102,4 @@ export function addCss(cssText: string): void {
global.__onUncaughtError = function (error: NativeScriptError) {
events.notify(<UnhandledErrorEventData>{ eventName: uncaughtErrorEvent, object: app, android: error, ios: error, error: error });
}
}