добавил поддержку чанков webpack
This commit is contained in:
parent
88a38bc75e
commit
71ed2efbf4
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
11
src/main.ts
11
src/main.ts
@ -9,6 +9,8 @@ declare var System: {
|
||||
import(string): Promise<any>
|
||||
}
|
||||
|
||||
declare var __webpack_public_path__: string;
|
||||
|
||||
const systemJSImport = async (requestUrl: string) => {
|
||||
const { default: component, mount, unmount } = await System.import(
|
||||
requestUrl
|
||||
@ -16,7 +18,7 @@ const systemJSImport = async (requestUrl: string) => {
|
||||
return { component, mount, unmount }
|
||||
}
|
||||
|
||||
const getApp = (apps, path) => {
|
||||
const getPublicPath = (apps, path) => {
|
||||
const searchKey = path.substr(1)
|
||||
return `./${searchKey}/${apps[searchKey].version}/index.js`
|
||||
}
|
||||
@ -27,10 +29,11 @@ export default async ({ apps, navigations, config }) => {
|
||||
|
||||
let prevPathname = window.location.pathname
|
||||
|
||||
/* tslint:disable-next-line */
|
||||
__webpack_public_path__ = `/static${__webpack_public_path__}`
|
||||
const publicPath = getPublicPath(apps, history.location.pathname)
|
||||
|
||||
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user