fix virtual module

This commit is contained in:
Andrey Vlasov 2020-03-29 12:49:07 +03:00
parent 47839a963c
commit 0636ce1ff2
3 changed files with 21 additions and 18 deletions

16
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import "systemjs/dist/s"; import "systemjs/dist/system";
import "systemjs/dist/extras/amd"; import "systemjs/dist/extras/amd";
import "systemjs/dist/extras/named-register"; import "systemjs/dist/extras/named-register";
import "systemjs/dist/extras/named-exports"; import "systemjs/dist/extras/named-exports";
@ -34,7 +34,7 @@ const systemJSImport = async (requestUrl: string) => {
// } // }
export default async ({ apps: rawApps, navigations, config }) => { export default async ({ apps: rawApps, navigations, config }) => {
defineVirtualModule({navigations, config}) defineVirtualModule({ navigations, config })
const apps = new Apps(rawApps) const apps = new Apps(rawApps)

View File

@ -1,12 +1,15 @@
export const defineVirtualModule = (params) => { const createVirtualModule = ({ config, navigations }) => ({
const virtualModule = createVirtualModule(params)
// @ts-ignore
global.define('@ijl/fire.app', [], virtualModule)
}
const createVirtualModule = ({config, navigations}) => ({
getConfig: () => config, getConfig: () => config,
getConfigValue: (key) => config[key], getConfigValue: (key) => config[key],
getNavigations: () => navigations, getNavigations: () => navigations,
getNavigationsValue: (key) => navigations[key], getNavigationsValue: (key) => navigations[key],
}) })
export const defineVirtualModule = (params) => {
const virtualModule = createVirtualModule(params)
// @ts-ignore
System.set('root.scope', {
...virtualModule
});
}