tmp fix reactive

This commit is contained in:
antony 2024-12-23 13:38:00 +07:00
parent e74fce0aa9
commit 8bacb8406e
7 changed files with 65 additions and 33 deletions

View File

@ -18,5 +18,6 @@ pnpm serve
# TODO # TODO
- Enable CORS on remote JS assets - Build-mode works but Dev-mode not works
- Scoped style still not works - Enable CORS on remote JS assets (fixed)
- Scoped style still not works (fixed)

14
host/error.vue Normal file
View File

@ -0,0 +1,14 @@
<script setup lang="ts">
import type { NuxtError } from "#app"
const props = defineProps({
error: Object as () => NuxtError
})
</script>
<template>
<div>
<h1>Ooops... Something went wrong...</h1>
<NuxtLink to="/">Go back home</NuxtLink>
</div>
</template>

View File

@ -10,19 +10,24 @@ export default defineNuxtConfig({
preset: "static" preset: "static"
}, },
vite: { vite: {
plugins: [ $client: {
topLevelAwait({ plugins: [
promiseExportName: "__tla", topLevelAwait({
promiseImportName: (i) => `__tla_${i}` promiseExportName: "__tla",
}), promiseImportName: (i) => `__tla_${i}`
federation({ }),
name: "host-app", federation({
remotes: { name: "host-app",
remote: "http://localhost:3001/_nuxt/remoteEntry.js" remotes: {
} remote: "http://localhost:3001/_nuxt/remoteEntry.js"
// shared: ["vue"] },
}) shared: ["vue"]
] })
]
},
$server: {
plugins: []
}
}, },
experimental: { experimental: {
asyncEntry: true asyncEntry: true

View File

@ -12,7 +12,7 @@
"postinstall": "nuxt prepare", "postinstall": "nuxt prepare",
"clean": "rimraf .output dist", "clean": "rimraf .output dist",
"clean2": "rimraf --glob node_modules", "clean2": "rimraf --glob node_modules",
"serve": "serve .output/public -p 3000" "serve": "serve .output/public -p 3000 --single"
}, },
"dependencies": { "dependencies": {
"nuxt": "^3.13.0", "nuxt": "^3.13.0",

View File

@ -10,21 +10,27 @@ export default defineNuxtConfig({
preset: "static" preset: "static"
}, },
vite: { vite: {
plugins: [ $client: {
topLevelAwait({ plugins: [
promiseExportName: "__tla", topLevelAwait({
promiseImportName: (i) => `__tla_${i}` promiseExportName: "__tla",
}), promiseImportName: (i) => `__tla_${i}`
federation({ }),
name: "remote-app", federation({
filename: "remoteEntry.js", name: "remote-app",
exposes: { filename: "remoteEntry.js",
"./RemoteContactRouter": "./components/RemoteContactRouter.vue" exposes: {
}, "./RemoteContactRouter": "./components/RemoteContactRouter.vue"
shared: [] },
// shared: ['vue'] // shared: []
}) shared: ["vue"]
] })
]
},
$server: {
plugins: []
}
// build: { // build: {
// target: "esnext" // target: "esnext"
// } // }

View File

@ -12,7 +12,7 @@
"postinstall": "nuxt prepare", "postinstall": "nuxt prepare",
"clean": "rimraf .output dist", "clean": "rimraf .output dist",
"clean2": "rimraf --glob node_modules", "clean2": "rimraf --glob node_modules",
"serve": "serve .output/public -p 3001 --cors" "serve": "serve .output/public -p 3001 --cors --single"
}, },
"dependencies": { "dependencies": {
"nuxt": "^3.13.0", "nuxt": "^3.13.0",

View File

@ -2,9 +2,15 @@
<div class="rmt"> <div class="rmt">
<h1>rmt/pages/contact/index.vue</h1> <h1>rmt/pages/contact/index.vue</h1>
<div>Contact index</div> <div>Contact index</div>
<div>
count: {{ count }}
<button type="button" @click="count++">increment+</button>
</div>
</div> </div>
</template> </template>
<script setup></script> <script setup>
const count = ref(0)
</script>
<style scoped> <style scoped>
.rmt { .rmt {
background-color: antiquewhite; background-color: antiquewhite;