https 替换

This commit is contained in:
2025-12-27 17:34:19 +08:00
parent 55801fa0ec
commit 0fb7a4ffb2
18 changed files with 233 additions and 293 deletions

View File

@@ -4,6 +4,7 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
import { federation } from '@module-federation/vite'
import { resolve, dirname } from 'path'
import { fileURLToPath } from 'url'
import fs from 'fs'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
@@ -26,7 +27,7 @@ export default defineConfig(({ mode }) => ({
shared: {
type: 'module',
name: 'shared',
entry: 'http://localhost:7000/remoteEntry.js'
entry: 'https://org.xyzh.yslg/shared/remoteEntry.js'
}
},
shared: {
@@ -56,6 +57,11 @@ export default defineConfig(({ mode }) => ({
host: true,
cors: true,
open: '/workcase/', // 开发时自动打开到 /workcase/ 路径
// HTTPS 配置(使用 mkcert 生成的本地开发证书)
https: {
key: fs.readFileSync('C:/Users/FK05/443/localhost+3-key.pem'),
cert: fs.readFileSync('C:/Users/FK05/443/localhost+3.pem')
},
hmr: {
// 修复 base 路径导致的 WebSocket 连接问题
path: '/@vite/client',
@@ -67,11 +73,6 @@ export default defineConfig(({ mode }) => ({
changeOrigin: true,
ws: true, // 启用 WebSocket 代理
rewrite: (path: string) => path.replace(/^\/api/, '')
},
// 代理共享模块请求到 shared 服务
'/shared': {
target: 'http://localhost:7000',
changeOrigin: true
}
}
},