easyai-mfe-demo/host/nuxt.config.ts
2025-08-14 09:14:55 +08:00

55 lines
1.3 KiB
TypeScript

import { defineNuxtConfig } from "nuxt/config"
import federation from "@originjs/vite-plugin-federation"
import topLevelAwait from "vite-plugin-top-level-await"
const MFE_HOST = process.env.NUXT_MFE_APP1_HOST
export default defineNuxtConfig({
compatibilityDate: "2024-04-03",
devtools: { enabled: false },
ssr: false,
nitro: {
preset: "static"
},
vite: {
server: {
proxy: {
// "^/node_modules/.*": {
// target: "http://localhost:3000",
// changeOrigin: true,
// rewrite: (path) =>
// path.replace(/^\/node_modules\//, "/_nuxt/node_modules/")
// },
"^/remote/*": {
target: "http://localhost:3005",
changeOrigin: true,
rewrite: (path) =>
path.replace(/^\/remote\//, "")
}
}
},
$client: {
plugins: [
topLevelAwait({
promiseExportName: "__tla",
promiseImportName: (i) => `__tla_${i}`
}),
federation({
name: "host-app",
remotes: {
remote: `${MFE_HOST}/_nuxt/remoteEntry.js`
},
shared: ["vue", "pinia"]
})
]
},
$server: {
plugins: []
}
},
plugins: ["~/plugins/pinia"],
experimental: {
asyncEntry: true
}
})