优化 Vite 配置,移除不再使用的代理规则,更新多个组件以增强远程组件加载逻辑,添加错误处理和加载状态显示,提升用户体验。

This commit is contained in:
jxxghp
2025-05-06 21:34:49 +08:00
parent 05cc160311
commit 703204c69a
7 changed files with 214 additions and 447 deletions

View File

@@ -6,14 +6,15 @@ export default defineConfig({
plugins: [
vue(),
federation({
name: 'my_plugin',
name: 'LogsClean',
filename: 'remoteEntry.js',
exposes: {
'./Page': './src/components/Page.vue',
'./Config': './src/components/Config.vue',
'./Dashboard': './src/components/Dashboard.vue',
},
shared: ['vue', 'vuetify']
shared: ['vue', 'vuetify'],
format: 'esm'
})
],
build: {
@@ -25,5 +26,10 @@ export default defineConfig({
port: 5001, // 使用不同于主应用的端口
cors: true, // 启用CORS
origin: 'http://localhost:5001'
},
preview: {
port: 5001, // 保持与server相同的端口
cors: true, // 启用CORS
origin: 'http://localhost:5001'
}
})