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-exposesUsage
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",
};