fix(plugin-qiankun): 处理publicPath

This commit is contained in:
万纯 2021-03-23 14:35:38 +08:00
parent e95361a572
commit 4870e093ac

View File

@ -34,11 +34,9 @@ export default function (api) {
const { shouldNotModifyRuntimePublicPath } = qiankunConfig;
if (runtimePublicPath === true && !shouldNotModifyRuntimePublicPath) {
// 这里必须使用__INJECTED_PUBLIC_PATH_BY_QIANKUN__因为绝对地址只在开发时生效。
// return `window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ || "${api.config.publicPath || '/'}"`;
const port = api.getPort();
return `//localhost:${port}${api.config.publicPath || '/'}`;
return `window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ || "${
api.config.publicPath || '/'
}"`;
}
return publicPathStr;