端口修改

This commit is contained in:
2025-12-15 14:50:29 +08:00
parent 302173f623
commit 3767150fd6
16 changed files with 52 additions and 52 deletions

View File

@@ -40,11 +40,11 @@ pnpm run dev
# 方式3: 手动启动(需要两个终端)
# 终端1 - 启动 shared
cd packages/shared
pnpm run dev # http://localhost:5000
pnpm run dev # http://localhost:7000
# 终端2 - 启动 platform
cd packages/platform
pnpm run dev # http://localhost:5001
pnpm run dev # http://localhost:7001
```
### 3. 构建生产版本
@@ -110,7 +110,7 @@ export default defineConfig({
})
],
server: {
port: 5000,
port: 7000,
strictPort: true, // 关键:锁定端口,避免漂移
host: true,
cors: true
@@ -131,7 +131,7 @@ export default defineConfig({
shared: {
type: 'module', // 关键:必须指定 ES module 类型
name: 'shared',
entry: 'http://localhost:5000/remoteEntry.js'
entry: 'http://localhost:7000/remoteEntry.js'
}
},
shared: {
@@ -230,4 +230,4 @@ const result = await authAPI.login(params)
2. **启动顺序**: 必须先启动 `shared` 服务5000端口再启动其他应用
3. **端口占用**: 确保 5000-5003 端口未被占用shared 使用 strictPort 模式
4. **Node 版本**: 建议使用 Node.js 18+
5. **Module Federation**: remoteEntry.js 路径为 `http://localhost:5000/remoteEntry.js`(不是 /assets/
5. **Module Federation**: remoteEntry.js 路径为 `http://localhost:7000/remoteEntry.js`(不是 /assets/