Skip to content

Commit

Permalink
fix(): 支持 union app root 的变量
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaofengxi committed Mar 28, 2024
1 parent 4b9388f commit 0d4a958
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/brick-container/serve/getIndexHtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ const injectIndexHtml = (standaloneConfig, env, content) => {
: `w.BOOTSTRAP_FILE=a+"-/bootstrap${
standaloneConfig.bootstrapPathPrefix ?? ""
}.${standaloneConfig.bootstrapHash}.json"`,
standaloneConfig.unionAppRoot
? `var b=${standaloneConfig.unionAppRoot}`
: "",
standaloneConfig.bootstrapUnionFilePath ?? "",
standaloneConfig.appRootTpl ?? "",
standaloneConfig.publicDeps
Expand Down
6 changes: 6 additions & 0 deletions packages/brick-container/serve/getProxies.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@ module.exports = (env, getRawIndexHtml) => {
}
const appRoot = JSON.parse(appRootMatches[1]);

const unionAppRoot = raw.match(
/\b(w\.UNION_APP_ROOT\s*=\s*[^;]*\s*;)/
)?.[1];

const bootstrapUnionMatches = raw.match(
/\b(w\.BOOTSTRAP_UNION_FILE\s*=\s*[^;]*\s*;)/
);
Expand Down Expand Up @@ -538,6 +542,7 @@ module.exports = (env, getRawIndexHtml) => {
bootstrapHash,
bootstrapFilePath,
bootstrapPathPrefix,
unionAppRoot,
bootstrapUnionFilePath,
appRootTpl,
publicDeps,
Expand All @@ -556,6 +561,7 @@ module.exports = (env, getRawIndexHtml) => {
bootstrapHash,
bootstrapPathPrefix,
bootstrapFilePath,
unionAppRoot,
bootstrapUnionFilePath,
publicDeps,
appRootTpl,
Expand Down

0 comments on commit 0d4a958

Please sign in to comment.