@module-federation/vite 1.18.1 → 1.19.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 CHANGED
@@ -31,6 +31,7 @@ Examples live in [`gioboa/module-federation-vite-examples`](https://github.com/g
31
31
  | ---------------------------------------------------------------------------------------- | --------------- | ----------------- | --------------------------- |
32
32
  | [Alpine](https://github.com/gioboa/module-federation-vite-examples/tree/main/alpine) | `alpine-host` | `alpine-remote` | Alpine.js |
33
33
  | [Angular](https://github.com/gioboa/module-federation-vite-examples/tree/main/angular) | `angular-host` | `angular-remote` | Angular |
34
+ | [Astro](https://github.com/gioboa/module-federation-vite-examples/tree/main/astro) | `astro-host` | `astro-remote` | Astro 7 |
34
35
  | [Ember](https://github.com/gioboa/module-federation-vite-examples/tree/main/ember) | `ember-host` | `ember-remote` | Ember 7 |
35
36
  | [Lit](https://github.com/gioboa/module-federation-vite-examples/tree/main/lit) | `lit-host` | `lit-remote` | Lit |
36
37
  | [Nuxt](https://github.com/gioboa/module-federation-vite-examples/tree/main/nuxt) | `nuxt-host` | `nuxt-remote` | Nuxt 4 |
@@ -220,6 +221,28 @@ You can specify the place the host initialization file is injected with the **ho
220
221
  The **moduleParseTimeout** option allows you to configure the maximum time to wait for module parsing during the build process.
221
222
  The **moduleParseIdleTimeout** option is an alternative that resets the timer on every parsed module. It only fires when there has been no module activity for the configured duration, making it suitable for large codebases where the total build time exceeds the fixed timeout.
222
223
 
224
+ ## Runtime capability optimization
225
+
226
+ Runtime features that a build never uses can be removed at build time:
227
+
228
+ ```ts
229
+ federation({
230
+ name: "remote",
231
+ exposes: {
232
+ "./remote-app": "./src/App.vue",
233
+ },
234
+ disableRemote: true,
235
+ disableShared: true,
236
+ disableSnapshot: true,
237
+ });
238
+ ```
239
+
240
+ - `disableRemote` removes remote-consumption support. Do not enable it when `remotes` are configured.
241
+ - `disableShared` removes shared-dependency support. Do not enable it when `shared` dependencies are configured.
242
+ - `disableSnapshot` removes snapshot support, including manifest-based remotes, preload, dynamic type hints, HMR, and devtools integration.
243
+
244
+ All three options default to `false`, except `disableSnapshot`, which defaults to `true` for Node/SSR builds. An explicitly configured Vite `define` value takes precedence over the corresponding option.
245
+
223
246
  ## Load the Remote App
224
247
 
225
248
  In your host app, you can now import and use the remote app with **defineAsyncComponent**
package/lib/index.d.ts CHANGED
@@ -96,6 +96,27 @@ type ModuleFederationOptions = {
96
96
  * @default 'web' (or 'node' if build.ssr is enabled)
97
97
  */
98
98
  target?: 'web' | 'node';
99
+ /**
100
+ * Removes remote-consumption support from the federation runtime.
101
+ * Only enable this for builds that never load remotes.
102
+ *
103
+ * @default false
104
+ */
105
+ disableRemote?: boolean;
106
+ /**
107
+ * Removes shared-dependency support from the federation runtime.
108
+ * Only enable this when the build has no shared dependencies.
109
+ *
110
+ * @default false
111
+ */
112
+ disableShared?: boolean;
113
+ /**
114
+ * Removes snapshot support, including manifest-based remotes, preload,
115
+ * dynamic type hints, HMR, and devtools integration.
116
+ *
117
+ * @default false (true for Node/SSR builds)
118
+ */
119
+ disableSnapshot?: boolean;
99
120
  /**
100
121
  * Additional packages to mark as external in the SSR remote entry build.
101
122
  * Shared packages and MF runtime packages are always external. Use this to