__webpack_public_path__ поправлен
This commit is contained in:
		
							parent
							
								
									485fcad15c
								
							
						
					
					
						commit
						a907153d8b
					
				
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							@ -233,7 +233,7 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th
 | 
			
		||||
/***/ (function(module, exports, __webpack_require__) {
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__webpack_require__(/*! systemjs/dist/s */ \"./node_modules/systemjs/dist/s.js\");\n__webpack_require__(/*! systemjs/dist/extras/amd */ \"./node_modules/systemjs/dist/extras/amd.js\");\n__webpack_require__(/*! systemjs/dist/extras/named-register */ \"./node_modules/systemjs/dist/extras/named-register.js\");\n__webpack_require__(/*! systemjs/dist/extras/named-exports */ \"./node_modules/systemjs/dist/extras/named-exports.js\");\n__webpack_require__(/*! systemjs/dist/extras/transform */ \"./node_modules/systemjs/dist/extras/transform.js\");\nconst history_1 = __webpack_require__(/*! history */ \"./node_modules/history/esm/history.js\");\nconst systemJSImport = (requestUrl) => __awaiter(void 0, void 0, void 0, function* () {\n    const { default: component, mount, unmount } = yield System.import(requestUrl);\n    return { component, mount, unmount };\n});\nclass Apps extends Map {\n    constructor(apps) {\n        super();\n        this.findApp = (path) => {\n            const currentPath = [...this.keys()].reduce((memo, appRoute) => {\n                const correctedAppRoute = appRoute.replace(/^\\/?/, '/');\n                const correctedMemo = memo ? memo.replace(/^\\/?/, '/') : memo;\n                return this.startWithPath(path, correctedAppRoute) && this.startWithPath(correctedAppRoute, correctedMemo)\n                    ? appRoute\n                    : memo;\n            }, void 0);\n            return (this.get(currentPath) || this.get('/') || {\n                version: ''\n            });\n        };\n        this.merge(apps);\n    }\n    merge(apps) {\n        (Object.entries(apps).forEach(([path, options]) => this.set(path, options)));\n    }\n    startWithPath(path, subPath) {\n        if (!subPath) {\n            return true;\n        }\n        const pathItem = String(path).split('/');\n        const subPathItems = String(subPath).split('/');\n        return subPathItems.reduce((memo, appItem, index) => memo && pathItem[index] === appItem, true);\n    }\n}\nconst defaultNavigations = {\n    login: '/login',\n    main: '/main',\n    news: '/news',\n    org: '/org',\n    sections: '/sections',\n    'news.details': '/news/{{id}}',\n    'org.details': '/org/{{name}}',\n    'sections.details': '/sections/{{name}}'\n};\nconst defaultApps = {\n    login: { version: '1.0.0' },\n    main: { version: '1.0.1', name: 'main' },\n    news: { version: '1.0.0' },\n    org: { version: '1.0.0' },\n    sections: { version: '1.0.0' }\n};\nexports.default = ({ rawapps = defaultApps, navigations = defaultNavigations, config }) => __awaiter(void 0, void 0, void 0, function* () {\n    const apps = new Apps(rawapps);\n    const history = history_1.createBrowserHistory();\n    let prevPathname = window.location.pathname;\n    const app = apps.findApp(history.location.pathname);\n    // console.log('publicPath', publicPath)\n    const publicPath = `./${app.name}/${app.version}`;\n    __webpack_require__.p = `${publicPath}${__webpack_require__.p}`;\n    const appPath = `${config.baseUrl}/${publicPath}/index.js`;\n    const { component, mount, unmount } = yield systemJSImport(appPath);\n    mount(component.default);\n    history.listen((location) => {\n        if (location.pathname !== prevPathname) {\n            prevPathname = location.pathname;\n            unmount();\n        }\n    });\n});\n\n\n//# sourceURL=webpack://bootstrap/./src/main.ts?");
 | 
			
		||||
eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__webpack_require__(/*! systemjs/dist/s */ \"./node_modules/systemjs/dist/s.js\");\n__webpack_require__(/*! systemjs/dist/extras/amd */ \"./node_modules/systemjs/dist/extras/amd.js\");\n__webpack_require__(/*! systemjs/dist/extras/named-register */ \"./node_modules/systemjs/dist/extras/named-register.js\");\n__webpack_require__(/*! systemjs/dist/extras/named-exports */ \"./node_modules/systemjs/dist/extras/named-exports.js\");\n__webpack_require__(/*! systemjs/dist/extras/transform */ \"./node_modules/systemjs/dist/extras/transform.js\");\nconst history_1 = __webpack_require__(/*! history */ \"./node_modules/history/esm/history.js\");\nconst systemJSImport = (requestUrl) => __awaiter(void 0, void 0, void 0, function* () {\n    const { default: component, mount, unmount } = yield System.import(requestUrl);\n    return { component, mount, unmount };\n});\nclass Apps extends Map {\n    constructor(apps) {\n        super();\n        this.findApp = (path) => {\n            const currentPath = [...this.keys()].reduce((memo, appRoute) => {\n                const correctedAppRoute = appRoute.replace(/^\\/?/, '/');\n                const correctedMemo = memo ? memo.replace(/^\\/?/, '/') : memo;\n                return this.startWithPath(path, correctedAppRoute) && this.startWithPath(correctedAppRoute, correctedMemo)\n                    ? appRoute\n                    : memo;\n            }, void 0);\n            return (this.get(currentPath) || this.get('/') || {\n                version: ''\n            });\n        };\n        this.merge(apps);\n    }\n    merge(apps) {\n        (Object.entries(apps).forEach(([path, options]) => this.set(path, options)));\n    }\n    startWithPath(path, subPath) {\n        if (!subPath) {\n            return true;\n        }\n        const pathItem = String(path).split('/');\n        const subPathItems = String(subPath).split('/');\n        return subPathItems.reduce((memo, appItem, index) => memo && pathItem[index] === appItem, true);\n    }\n}\nconst defaultNavigations = {\n    login: '/login',\n    main: '/main',\n    news: '/news',\n    org: '/org',\n    sections: '/sections',\n    'news.details': '/news/{{id}}',\n    'org.details': '/org/{{name}}',\n    'sections.details': '/sections/{{name}}'\n};\nconst defaultApps = {\n    login: { version: '1.0.0' },\n    main: { version: '1.0.1', name: 'main' },\n    news: { version: '1.0.0' },\n    org: { version: '1.0.0' },\n    sections: { version: '1.0.0' }\n};\nexports.default = ({ apps: rowApps, navigations, config }) => __awaiter(void 0, void 0, void 0, function* () {\n    const apps = new Apps(rowApps);\n    const history = history_1.createBrowserHistory();\n    let prevPathname = window.location.pathname;\n    const app = apps.findApp(history.location.pathname);\n    const publicPath = `/${app.name}/${app.version}`;\n    __webpack_require__.p = `${config.baseUrl}${publicPath}${__webpack_require__.p}`;\n    const appPath = `${config.baseUrl}${publicPath}/index.js`;\n    const { component, mount, unmount } = yield systemJSImport(appPath);\n    mount(component.default);\n    history.listen((location) => {\n        if (location.pathname !== prevPathname) {\n            prevPathname = location.pathname;\n            unmount();\n        }\n    });\n});\n\n\n//# sourceURL=webpack://bootstrap/./src/main.ts?");
 | 
			
		||||
 | 
			
		||||
/***/ })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										16
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/main.ts
									
									
									
									
									
								
							@ -81,24 +81,24 @@ const defaultNavigations = {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const defaultApps = {
 | 
			
		||||
  login: { version: '1.0.0' },
 | 
			
		||||
  login: { version: '1.0.0', name: 'login' },
 | 
			
		||||
  main: { version: '1.0.1', name: 'main' },
 | 
			
		||||
  news: { version: '1.0.0' },
 | 
			
		||||
  org: { version: '1.0.0' },
 | 
			
		||||
  sections: { version: '1.0.0' }
 | 
			
		||||
  news: { version: '1.0.0', name: 'news' },
 | 
			
		||||
  org: { version: '1.0.0', name: 'org' },
 | 
			
		||||
  sections: { version: '1.0.0', name: 'sections' }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default async ({ rawapps, navigations, config }) => {
 | 
			
		||||
  const apps = new Apps(rawapps)
 | 
			
		||||
export default async ({ apps: rowApps, navigations, config }) => {
 | 
			
		||||
  const apps = new Apps(rowApps)
 | 
			
		||||
  const history = createBrowserHistory()
 | 
			
		||||
 | 
			
		||||
  let prevPathname = window.location.pathname
 | 
			
		||||
 | 
			
		||||
  const app = apps.findApp(history.location.pathname)
 | 
			
		||||
 | 
			
		||||
 const publicPath = `./${app.name}/${app.version}`
 | 
			
		||||
 const publicPath = `/${app.name}/${app.version}`
 | 
			
		||||
 | 
			
		||||
  __webpack_public_path__ = `${publicPath}${__webpack_public_path__}`
 | 
			
		||||
  __webpack_public_path__ = `${config.baseUrl}${publicPath}${__webpack_public_path__}`
 | 
			
		||||
 | 
			
		||||
  const appPath = `${config.baseUrl}${publicPath}/index.js`
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user