Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
minio-scs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhaozhenxing
minio-scs
Commits
6cf022cd
提交
6cf022cd
authored
8月 30, 2022
作者:
yueyang.lv
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
build(模块联邦): 打包方案调整
remote 路径支持变量控制
上级
15fd69f2
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
41 行增加
和
10 行删除
+41
-10
buildServer.js
buildServer.js
+15
-0
config-mf.js
config-mf.js
+21
-8
index.tsx
src/saturnCloud/index.tsx
+5
-2
没有找到文件。
buildServer.js
0 → 100644
浏览文件 @
6cf022cd
const
express
=
require
(
"express"
);
const
setupProxy
=
require
(
"./src/setupProxy"
);
const
serveStatic
=
require
(
"serve-static"
);
var
history
=
require
(
"connect-history-api-fallback"
);
const
PORT
=
5001
;
const
app
=
express
();
setupProxy
(
app
);
app
.
use
(
history
());
// app.use(express.static("build"));
app
.
use
(
serveStatic
(
"build"
,
{
index
:
[
"index.html"
,
"index.htm"
]
}));
app
.
listen
(
PORT
);
console
.
log
(
`build 文件预览服务已开启 http://127.0.0.1:
${
PORT
}
`
);
config-mf.js
浏览文件 @
6cf022cd
...
...
@@ -20,21 +20,33 @@ function filterShared(keys) {
return
newDeps
;
}
const
isDev
=
process
.
env
.
NODE_ENV
!==
"production"
;
const
remoteOrigin
=
isDev
?
"http://localhost:9000"
:
process
.
env
.
REMOTE_URL
;
if
(
!
remoteOrigin
)
{
throw
new
Error
(
"打包失败:土星云远程模块地址不存在, 请在环境变量中设置 REMOTE_URL 为远程模块地址"
);
}
// 模块联邦
module
.
exports
=
function
(
config
,
env
)
{
// config.output.crossOriginLoading = "use-credentials";
config
.
output
.
crossOriginLoading
=
"anonymous"
;
console
.
log
(
`土星云业务远程地址为:
${
remoteOrigin
}
`
);
config
.
plugins
.
unshift
(
new
ModuleFederationPlugin
({
name
:
"minio_console"
,
remotes
:
{
saturnApp
:
"saturnApp@http://localhost:9000/remoteEntry.js"
,
},
filename
:
"remoteEntry.js"
,
exposes
:
{
"./PageLayout"
:
"./src/screens/Console/Common/Layout/PageLayout.tsx"
,
"./PageHeader"
:
"./src/screens/Console/Common/PageHeader/PageHeader.tsx"
,
"./history"
:
"./src/history.ts"
,
saturnApp
:
`saturnApp@
${
remoteOrigin
}
/remoteEntry.js`
,
},
// filename: "remoteEntry.js",
// exposes: {
// "./PageLayout": "./src/screens/Console/Common/Layout/PageLayout.tsx",
// "./PageHeader":
// "./src/screens/Console/Common/PageHeader/PageHeader.tsx",
// "./history": "./src/history.ts",
// },
shared
:
{
...
filterShared
([
// '@codemirror/lang-json',
...
...
@@ -69,6 +81,7 @@ module.exports = function (config, env) {
// 'redux',
// 'redux-thunk',
"superagent"
,
"react-router-dom"
,
// 'use-debounce',
// 'websocket',
// 'chart.js',
...
...
src/saturnCloud/index.tsx
浏览文件 @
6cf022cd
import
{
Suspense
,
lazy
,
useState
,
useEffect
}
from
"react"
;
import
{
NavLink
}
from
"react-router-dom"
;
import
LoadingComponent
from
"../common/LoadingComponent"
;
import
history
from
"../history"
;
// import RemoteComponent from "./RemoteComponent";
...
...
@@ -46,8 +47,10 @@ export function useSaturnConsoleMenu() {
useEffect
(()
=>
{
import
(
"saturnApp/consoleMenu"
)
.
then
((
res
)
=>
{
console
.
log
(
res
.
default
);
setMenu
(
res
.
default
);
const
createMenu
=
res
.
default
;
createMenu
(
NavLink
).
then
((
menu
)
=>
{
setMenu
(
menu
);
});
})
.
catch
((
e
)
=>
{
console
.
error
(
e
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论