добавил поддержку чанков webpack

This commit is contained in:
Andrey Vlasov 2020-02-29 17:57:08 +03:00
parent 88a38bc75e
commit 71ed2efbf4
2 changed files with 9 additions and 6 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -9,6 +9,8 @@ declare var System: {
import(string): Promise<any> import(string): Promise<any>
} }
declare var __webpack_public_path__: string;
const systemJSImport = async (requestUrl: string) => { const systemJSImport = async (requestUrl: string) => {
const { default: component, mount, unmount } = await System.import( const { default: component, mount, unmount } = await System.import(
requestUrl requestUrl
@ -16,7 +18,7 @@ const systemJSImport = async (requestUrl: string) => {
return { component, mount, unmount } return { component, mount, unmount }
} }
const getApp = (apps, path) => { const getPublicPath = (apps, path) => {
const searchKey = path.substr(1) const searchKey = path.substr(1)
return `./${searchKey}/${apps[searchKey].version}/index.js` return `./${searchKey}/${apps[searchKey].version}/index.js`
} }
@ -27,10 +29,11 @@ export default async ({ apps, navigations, config }) => {
let prevPathname = window.location.pathname let prevPathname = window.location.pathname
/* tslint:disable-next-line */ const publicPath = getPublicPath(apps, history.location.pathname)
__webpack_public_path__ = `/static${__webpack_public_path__}`
const app = getApp(apps, history.location.pathname) __webpack_public_path__ = `${publicPath}${__webpack_public_path__}`
const app = `${publicPath}/index.js`
const { component, mount, unmount } = await systemJSImport(app); const { component, mount, unmount } = await systemJSImport(app);