npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

webpack-federation-stats-plugin

v1.1.1

Published

export module federation stats

Readme

webpack-federation-stats-plugin

npm version npm downloads npm monthly downloads license

A Webpack plugin that extracts Module Federation stats into a JSON file. It maps each exposed module to its required chunks, making it useful for tools like loadable-components that need to know which chunks to load for a given federated module.

Installation

npm install --save-dev webpack-federation-stats-plugin

or

yarn add --dev webpack-federation-stats-plugin

Usage

const FederationStatsPlugin = require("webpack-federation-stats-plugin")

module.exports = {
  plugins: [new FederationStatsPlugin()],
}

Note: The plugin requires ModuleFederationPlugin to be configured in the same Webpack config. It will throw an error if it is not found.

Options

| Option | Type | Default | Description | | ----------- | -------- | ------------------------- | ------------------------------------------------ | | fileName | string | "federation-stats.json" | The name of the output JSON file. | | publicUrl | string | — | An optional public URL to include in the output. |

Example with options

const FederationStatsPlugin = require("webpack-federation-stats-plugin")

module.exports = {
  plugins: [
    new FederationStatsPlugin({
      fileName: "federation-stats.json",
      publicUrl: "https://cdn.example.com/",
    }),
  ],
}

Output

The plugin generates a JSON file that maps each exposed module to the chunk files it needs at runtime. This is the information a consuming application needs to know which scripts to load before importing a federated module.

Given the following Module Federation config:

const {ModuleFederationPlugin} = require("webpack").container
const FederationStatsPlugin = require("webpack-federation-stats-plugin")

module.exports = {
  plugins: [
    new ModuleFederationPlugin({
      name: "shop",
      exposes: {
        "./ProductCard": "./src/components/ProductCard",
        "./CartIcon": "./src/components/CartIcon",
        "./useCart": "./src/hooks/useCart",
      },
    }),
    new FederationStatsPlugin(),
  ],
}

The plugin will emit a federation-stats.json like this:

{
  "name": "shop",
  "exposes": {
    "ProductCard": ["vendors-node_modules_react-dom_index_js.js", "vendors-node_modules_styled-components_dist_index_js.js", "src_components_ProductCard_index_tsx.js"],
    "CartIcon": ["vendors-node_modules_react-dom_index_js.js", "src_components_CartIcon_index_tsx.js"],
    "useCart": ["src_hooks_useCart_ts.js"]
  }
}

Each key under exposes corresponds to an exposed module (without the ./ prefix), and its value is the list of chunk files that must be loaded for that module to work.

With publicUrl

When a publicUrl is provided, it is included in the output so consumers can resolve the full URL for each chunk:

{
  "name": "shop",
  "publicUrl": "https://cdn.example.com/shop/",
  "exposes": {
    "ProductCard": ["vendors-node_modules_react-dom_index_js.js", "vendors-node_modules_styled-components_dist_index_js.js", "src_components_ProductCard_index_tsx.js"],
    "CartIcon": ["vendors-node_modules_react-dom_index_js.js", "src_components_CartIcon_index_tsx.js"],
    "useCart": ["src_hooks_useCart_ts.js"]
  }
}

License

MIT