Registry / web-framework / vite-plugin-federation

vite-plugin-federation

JSON →
library0.0.4jsnpmunverified

A Vite plugin that enables Module Federation across Vite-based projects, allowing micro-frontends to share components, stores, and utilities at runtime. Current stable version is 0.0.4 (pre-release). Release cadence is rapid but untracked; the plugin is in early development. Key differentiators: native integration with Vite's dev server and build pipeline, support for Vite 5, 6, 7, and 8, and TypeScript-first design. Unlike Webpack Federation, this plugin leverages Vite's ESM-based module system for faster HMR and lighter builds. Requires Node >= 20.19.0 and Vite ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 as peer dependencies. Currently in pre-release; API may change without notice.

npm install vite-plugin-federation
INSTALL
IMPORT
SIG · VITE-PLUGIN-FEDERA
V
vite-plugin-federation
web-frameworkjavascriptv0.0.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

federation
import { federation } from 'vite-plugin-federation'
import federation from 'vite-plugin-federation'
The export is named, not default. Common mistake: using default import.
VitePluginFederationOptions
import type { VitePluginFederationOptions } from 'vite-plugin-federation'
import { VitePluginFederationOptions } from 'vite-plugin-federation'
Type only import avoids bundling. Use with TypeScript.
ExposeOptions
import type { ExposeOptions } from 'vite-plugin-federation'
Available via type export for configuring expose property.

Shows basic setup with Vite config using federation plugin, defining a remote and sharing React as singleton.

// vite.config.ts import { defineConfig } from 'vite'; import { federation } from 'vite-plugin-federation'; export default defineConfig({ plugins: [ federation({ name: 'my-host', remotes: { remote_app: 'http://localhost:3001/assets/remoteEntry.js', }, shared: { react: { singleton: true }, 'react-dom': { singleton: true }, }, }), ], }); // In a component: import('remote_app/Button').then(({ Button }) => { // use Button });
Debug
Known issues
breakingThe plugin is in pre-release (v0.0.x). Breaking changes may occur with minor version bumps.
fix
Lock version to current minor and test upgrades carefully. Monitor GitHub releases.
affects: >=0.0.0
deprecatedAPI may change without prior notice; no stability guarantees.
fix
Expect and adapt to changes. Follow the repository for updates.
affects: >=0.0.0
gotchaRequires Vite 5, 6, 7, or 8 as peer dependency. Using with Vite 4 will cause install errors.
fix
Ensure your project uses Vite ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0.
affects: >=0.0.0
gotchaNode.js >=20.19.0 required. Older Node versions may not work.
fix
Update Node.js to 20.19.0 or higher.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'vite-plugin-federation' or its corresponding type declarations.
Package not installed or TypeScript not configured to resolve it.
fix
npm install vite-plugin-federation --save-dev && ensure tsconfig includes 'moduleResolution': 'bundler' or 'node16'.
Cannot import the named export 'federation' from non EcmaScript module (only default export is available)
Trying to use named import 'federation' but the package version might be CJS or the import style is wrong.
fix
Use import { federation } from 'vite-plugin-federation' (ESM). If using require, use const { federation } = require('vite-plugin-federation').
Uncaught TypeError: Failed to fetch dynamically imported module: /assets/remoteEntry.js
Remote entry URL is incorrect or CORS not configured.
fix
Verify the remote URL and ensure CORS headers are set on the remote server.
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources
vite-plugin-federation — npm install vite-plugin-federation · libregistry