Registry / devops / rollup-plugin-module-federation

rollup-plugin-module-federation

JSON →
library1.11.8jsnpmunverified

Rollup plugin enabling Module Federation for Rollup, allowing micro-frontend architectures with shared dependencies and remote entry points. Current stable version 1.11.8, released about 2 months ago, with moderate release cadence. Differentiator: brings Webpack Module Federation concepts to Rollup, targeting Node >= 18, with no known alternatives for Rollup. Provides exposure of `exposes` and `remotes` in Rollup configuration.

npm install rollup-plugin-module-federation
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-MODU
R
rollup-plugin-module-federation
devopsjavascriptv1.11.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

moduleFederationPlugin
import { moduleFederationPlugin } from 'rollup-plugin-module-federation'
const moduleFederationPlugin = require('rollup-plugin-module-federation')
Package is ESM-only since v1; requires Node >= 18.
ModuleFederationPlugin
import { ModuleFederationPlugin } from 'rollup-plugin-module-federation'
import ModuleFederationPlugin from 'rollup-plugin-module-federation'
Default export is not available; always use named import. Both `moduleFederationPlugin` and `ModuleFederationPlugin` exist as aliases.
rollup-plugin-module-federation
import pkg from 'rollup-plugin-module-federation'
There is no default export; this import only works if you are using a bundler or Node ESM that allows default import from a module with only named exports, but it's not recommended.

Minimal Rollup configuration with moduleFederationPlugin to expose Button and consume remote from another app, with shared React dependencies.

import { moduleFederationPlugin } from 'rollup-plugin-module-federation'; export default { input: 'src/index.js', plugins: [ moduleFederationPlugin({ name: 'my_app', filename: 'remoteEntry.js', exposes: { './Button': './src/Button.js', }, remotes: { 'my_other_app': 'http://localhost:3001/remoteEntry.js', }, shared: { react: { singleton: true }, 'react-dom': { singleton: true }, }, }), ], output: { dir: 'dist', format: 'esm', }, };
Debug
Known issues
breakingPackage requires Node >= 18.0.0. Older versions will fail with syntax errors.
fix
Upgrade Node.js to version 18 or above.
affects: <18.0.0
breakingESM-only; CommonJS require() will throw an error.
fix
Use import syntax or dynamic import. If using CommonJS, use dynamic import: const plugin = await import('rollup-plugin-module-federation');
affects: >=1.0.0
gotchaThe plugin supports both 'moduleFederationPlugin' and 'ModuleFederationPlugin' as named exports, but default export is not available.
fix
Always use named import: import { moduleFederationPlugin } from 'rollup-plugin-module-federation';
affects: >=1.0.0
gotchaThe plugin does not support all Webpack Module Federation features; e.g., dynamic loading of remotes may require additional configuration.
fix
Review the plugin's documentation for supported options; test remote loading behavior.
affects: >=1.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module
Using require() with an ESM-only package in Node < 18 or without --experimental-require-module flag.
fix
Use import() or switch to Node >= 18 with package.json type: module or use dynamic import.
Module not found: Default condition should be last one
Webpack-like error when using this plugin with a bundler that doesn't support ESM exports field properly.
fix
Ensure your bundler (e.g., Rollup, webpack) supports the 'exports' field in package.json.
TypeError: Cannot read properties of undefined (reading 'exposes')
Missing or misconfigured options object passed to plugin.
fix
Ensure options includes 'name' and at least one of 'exposes' or 'remotes'.
Upgrade
Version history
1.11.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-module-federation — npm install rollup-plugin-module-federation · libregistry