Skip to content

Commit 49d7a5e

Browse files
committed
feat: just a simple runtime microfrontends test
1 parent 9fe4688 commit 49d7a5e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/App.vue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,29 @@
22
import { RouterView } from "@kitbag/router";
33
import Layout from "@/components/layout/Layout.vue";
44
import ErrorBoundary from "@/components/handlers/ErrorBoundary.vue";
5+
import { createInstance } from "@module-federation/enhanced/runtime";
6+
import { defineAsyncComponent } from "vue";
7+
8+
const mf = createInstance({
9+
"name" : "mf_host",
10+
"remotes": [],
11+
});
12+
13+
mf.registerRemotes([
14+
{
15+
"name" : "remote1",
16+
"alias": "remote-1",
17+
"entry": "https://unpkg.com/module-federation-rslib-provider@latest/dist/mf/mf-manifest.json",
18+
},
19+
]);
20+
21+
const Huh = defineAsyncComponent(async () => {
22+
const { MyButton } = await mf.loadRemote("remote1") as { "MyButton": unknown };
23+
24+
return {
25+
"default": MyButton,
26+
};
27+
});
528
</script>
629

730
<template>
@@ -10,6 +33,7 @@ import ErrorBoundary from "@/components/handlers/ErrorBoundary.vue";
1033
<template #default>
1134
<Layout>
1235
<RouterView />
36+
<Huh />
1337
</Layout>
1438
</template>
1539

0 commit comments

Comments
 (0)