phodal / mooa

Mooa 是一个为 Angular 服务的微前端框架。A independent-deployment micro-frontend Framework for Angular from single-spa.

Home Page:http://mooa.phodal.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

关于主应用使用nginx部署后如何加载子应用问题

ywager opened this issue · comments

Hi phodal 想和您请教下关于主应用在部署后如何加载子应用问题
下面的步骤不确定是不是正常的加载流程

现有一个主应用A和一个子应用B
如果A已经使用nginx部署,现需要在A中加入B(默认A中页面导航列表已有B的导航)
例如A在部署环境中,部署的位置为/root/host/dist,下面是A加入B的步骤
1.Build B应用
2.在A应用/root/host/dist/assets/目录创建子应用目录B
3.将B应用dist里面的文件拷贝到/root/host/dist/assets/B/目录中
4.例如/root/host/目录有apps.txt文件,在apps.txt中写入B的路径
http://x.x.x.x/assets/B/
5.生成配置文件apps.json如下,但是B的应用的name和prefix为空
[
{
"name": "",
"selector": "app-root",
"baseScriptUrl": "/assets/B/",
"styles": [
"styles.ac89bfdd6de82636b768.bundle.css"
],
"prefix": "",
"scripts": [
"inline.487161648483f67d0373.bundle.js",
"polyfills.194f3db5c95bb635c66b.bundle.js",
"main.ca9f5cd21ebc06c1d73a.bundle.js"
]
}
]

这时候A加载B失败.

如果 /root/host/ 指向的是主应用,那么子应用的路径应该是 /root/host/assets/B

Hi phodal, thanks for your reply.
子应用就是放在了/root/host/assets/B目录,
原因找到了配置应用路径http://x.x.x.x/assets/B/,后面多了"/".