@module-federation/vite 1.15.4 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -1
- package/lib/index.cjs +1123 -870
- package/lib/index.d.cts +22 -6
- package/lib/index.d.mts +22 -6
- package/lib/index.mjs +1063 -793
- package/lib/packageUtils-CbbnJvKu.cjs +358 -0
- package/lib/packageUtils-DOekOsFz.mjs +250 -0
- package/lib/pluginDts-B5pcUmam.mjs +309 -0
- package/lib/pluginDts-BEOKyKQ-.cjs +311 -0
- package/lib/utils/ssrEntryLoader.cjs +301 -0
- package/lib/utils/ssrEntryLoader.d.cts +65 -0
- package/lib/utils/ssrEntryLoader.d.mts +66 -0
- package/lib/utils/ssrEntryLoader.mjs +301 -0
- package/package.json +13 -5
package/README.md
CHANGED
|
@@ -19,11 +19,13 @@ Examples live in [`gioboa/module-federation-vite-examples`](https://github.com/g
|
|
|
19
19
|
| [Angular](https://github.com/gioboa/module-federation-vite-examples/tree/main/angular) | `angular-host` | `angular-remote` | Angular |
|
|
20
20
|
| [Lit](https://github.com/gioboa/module-federation-vite-examples/tree/main/lit) | `lit-host` | `lit-remote` | Lit |
|
|
21
21
|
| [Nuxt](https://github.com/gioboa/module-federation-vite-examples/tree/main/nuxt) | `nuxt-host` | `nuxt-remote` | Nuxt 4 |
|
|
22
|
+
| [Nx](https://github.com/gioboa/react-nx-microfrontend-demo) | `host` | `remote` | React + Nx |
|
|
22
23
|
| [Preact](https://github.com/gioboa/module-federation-vite-examples/tree/main/preact) | `preact-host` | `preact-remote` | Preact 10 |
|
|
23
24
|
| [React](https://github.com/gioboa/module-federation-vite-examples/tree/main/react) | `react-host` | `react-remote` | React 19 |
|
|
24
25
|
| [Solid](https://github.com/gioboa/module-federation-vite-examples/tree/main/solid) | `solid-host` | `solid-remote` | Solid |
|
|
25
26
|
| [Svelte](https://github.com/gioboa/module-federation-vite-examples/tree/main/svelte) | `svelte-host` | `svelte-remote` | Svelte 5 |
|
|
26
27
|
| [TanStack](https://github.com/gioboa/module-federation-vite-examples/tree/main/tanstack) | `tanstack-host` | `tanstack-remote` | TanStack Router + React 19 |
|
|
28
|
+
| [Turborepo](https://github.com/gioboa/react-turborepo-microfrontend-demo) | `host` | `remote` | React + Turborepo |
|
|
27
29
|
| [Vinext](https://github.com/gioboa/module-federation-vite-examples/tree/main/vinext) | `vinext-host` | `vinext-remote` | Vinext + Next 16 + React 19 |
|
|
28
30
|
| [Vue](https://github.com/gioboa/module-federation-vite-examples/tree/main/vue) | `vue-host` | `vue-remote` | Vue 3 |
|
|
29
31
|
|
|
@@ -45,13 +47,40 @@ pnpm run multi-example
|
|
|
45
47
|
|
|
46
48
|
## Getting started 🚀
|
|
47
49
|
|
|
48
|
-
https://module-federation.io/guide/
|
|
50
|
+
[https://module-federation.io/guide/build-plugins/plugins-vite.html](https://module-federation.io/guide/build-plugins/plugins-vite.html)
|
|
49
51
|
|
|
50
52
|
With **@module-federation/vite**, the process becomes delightfully simple, you will only find the differences from a normal Vite configuration.
|
|
51
53
|
|
|
52
54
|
> This example is with [Vue.js](https://vuejs.org/)</br>
|
|
53
55
|
> The @module-federation/vite configuration remains the same for different frameworks.
|
|
54
56
|
|
|
57
|
+
## Dedicated configuration file
|
|
58
|
+
|
|
59
|
+
You can keep Module Federation options in `module-federation.config.ts`.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { createModuleFederationConfig } from '@module-federation/vite';
|
|
63
|
+
|
|
64
|
+
export default createModuleFederationConfig({
|
|
65
|
+
name: 'remote',
|
|
66
|
+
filename: 'remoteEntry.js',
|
|
67
|
+
exposes: {
|
|
68
|
+
'./remote-app': './src/App.vue',
|
|
69
|
+
},
|
|
70
|
+
shared: ['vue'],
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { defineConfig } from 'vite';
|
|
76
|
+
import { federation } from '@module-federation/vite';
|
|
77
|
+
import moduleFederationConfig from './module-federation.config';
|
|
78
|
+
|
|
79
|
+
export default defineConfig({
|
|
80
|
+
plugins: [federation(moduleFederationConfig)],
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
55
84
|
## The Remote Application configuration
|
|
56
85
|
|
|
57
86
|
file: **remote/vite.config.ts**
|