Skip to content

Commit

Permalink
fix(runtime): better error for unknown mode
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Dec 19, 2019
1 parent 09ae5e0 commit d0eeec0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/client/client-load-module.ts
@@ -1,6 +1,6 @@
import * as d from '../declarations';
import { BUILD } from '@app-data';
import { consoleError } from './client-log';
import { consoleError, consoleDevError } from './client-log';

export const cmpModules = /*@__PURE__*/new Map<string, {[exportName: string]: d.ComponentConstructor}>();

Expand All @@ -10,6 +10,10 @@ export const loadModule = (cmpMeta: d.ComponentRuntimeMeta, hostRef: d.HostRef,
const bundleId = ((BUILD.mode && typeof cmpMeta.$lazyBundleIds$ !== 'string')
? cmpMeta.$lazyBundleIds$[hostRef.$modeName$]
: cmpMeta.$lazyBundleIds$) as string;
if (BUILD.isDev && typeof bundleId !== 'string') {
consoleDevError(`Trying to lazyly load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`);
return undefined;
}
const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
if (module) {
return module[exportName];
Expand Down

0 comments on commit d0eeec0

Please sign in to comment.