This commit is contained in:
antony
2024-12-20 22:58:41 +07:00
commit f438d49f55
18 changed files with 13792 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
<template>
<div class="container mx-auto p-4">
<h1 class="text-2xl font-bold mb-4">Nuxt 3 MFE Remote App</h1>
<RemoteComponent />
</div>
</template>
+22
View File
@@ -0,0 +1,22 @@
<template>
<div class="p-4 border rounded bg-blue-50 sty1">
<h2 class="text-xl mb-2">Remote Component</h2>
<p>This component is exposed from the remote application</p>
</div>
</template>
<script setup>
defineComponent({
name: 'RemoteComponent'
})
onMounted(() => {
console.log('mounted')
})
</script>
<style>
.sty1 {
background: pink;
}
</style>
+24
View File
@@ -0,0 +1,24 @@
import { defineNuxtConfig } from 'nuxt/config'
import federation from '@originjs/vite-plugin-federation'
export default defineNuxtConfig({
compatibilityDate: '2024-04-03',
devtools: { enabled: false },
ssr: false,
vite: {
plugins: [
federation({
name: 'remote-app',
filename: 'remoteEntry.js',
exposes: {
'./RemoteComponent': './components/RemoteComponent.vue'
},
shared: []
// shared: ['vue']
})
],
build: {
target: 'esnext'
}
}
})
+24
View File
@@ -0,0 +1,24 @@
{
"name": "nuxt-mfe-remote",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "HOST=0.0.0.0 PORT=3001 nuxt dev",
"pregenerate": "npm run clean",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"clean": "rimraf .output",
"serve": "serve .output/public -p 3001"
},
"dependencies": {
"nuxt": "^3.13.0",
"vue": "^3.5.13"
},
"devDependencies": {
"serve": "*",
"rimraf": "6",
"@originjs/vite-plugin-federation": "^1.3.5"
}
}
+6797
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

+1
View File
@@ -0,0 +1 @@
+4
View File
@@ -0,0 +1,4 @@
{
// https://v3.nuxtjs.org/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}