JSPM

webpack-federation-obj-exposes

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 63
    • Score
      100M100P100Q74355F
    • License ISC

    Configure Webpack 5 Module Federation exposes through a nested object hierarchy.

    Package Exports

    • webpack-federation-obj-exposes

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (webpack-federation-obj-exposes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    webpack-federation-obj-exposes

    Configure Webpack 5 Module Federation exposes through a nested object hierarchy.

    Install

    > npm i --save-dev webpack-federation-obj-exposes

    Usage

    const objectExposes = require("webpack-federation-obj-exposes");
    
    const exposes = objectExposes({
      components: {
        AppShell: "./src/components/AppShell.jsx",
      },
    });
    
    // ...
    
    new ModuleFederationPlugin({
      name: "abtests",
      library: { type: "var", name: "abtests" },
      filename: "remoteEntry.js",
      exposes,
    });

    Examples

    Basic

    Input

    const objectExposes = require("webpack-federation-obj-exposes");
    
    const exposes = objectExposes({
      components: {
        AppShell: "./src/components/AppShell.jsx",
      },
    });

    Output

    const exposes = {
      "./components/AppShell": "./src/components/AppShell.jsx",
    };

    Custom Path

    Input

    const objectExposes = require("webpack-federation-obj-exposes");
    
    const exposes = objectExposes(
      {
        components: {
          AppShell: "./src/components/AppShell.jsx",
        },
      },
      "./example"
    );

    Output

    const exposes = {
      "./example/components/AppShell": "./src/components/AppShell.jsx",
    };