chore: remote url from env

This commit is contained in:
antony
2024-12-23 15:55:38 +07:00
parent 5614ed542a
commit 9550591048
3 changed files with 33 additions and 7 deletions
+29 -6
View File
@@ -2,13 +2,14 @@
MFE with Nuxt being the Host and Remote
## Initial setup
```
cd host
pnpm i
pnpm build
pnpm serve
cp .env.example .env
```
## Development
```
cd remote
pnpm i
@@ -16,8 +17,30 @@ pnpm build
pnpm serve
```
# TODO
```
cd host
pnpm i
pnpm dev
```
- Build-mode works but Dev-mode not works
Open http://localhost:3000
## Deployment
```
cd remote
pnpm i
pnpm build
pnpm serve
cd host
pnpm i
pnpm build
pnpm serve
```
## TODO
- Build-mode works but Dev-mode not works (fixed)
- Enable CORS on remote JS assets (fixed)
- Scoped style still not works (fixed)
+1
View File
@@ -0,0 +1 @@
NUXT_MFE_APP1_HOST=http://localhost:3001
+3 -1
View File
@@ -2,6 +2,8 @@ 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 },
@@ -29,7 +31,7 @@ export default defineNuxtConfig({
federation({
name: "host-app",
remotes: {
remote: "http://localhost:3001/_nuxt/remoteEntry.js"
remote: `${MFE_HOST}/_nuxt/remoteEntry.js`
},
shared: ["vue"]
})