Skip to content

Commit f7012d3

Browse files
committed
feat(Build): Build module federation enabled bundles.
1 parent 1a376cc commit f7012d3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Webpack entry point for module federation.
2+
import "@patternslib/patternslib/webpack/module_federation";
3+
// The next import needs to be kept with brackets, otherwise we get this error:
4+
// "Shared module is not available for eager consumption."
5+
import("./bundle-config");

webpack.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
process.traceDeprecation = true;
2+
const mf_config = require("@patternslib/patternslib/webpack/webpack.mf");
3+
const package_json = require("./package.json");
24
const path = require("path");
35
const patternslib_config = require("@patternslib/patternslib/webpack/webpack.config.js");
46

57
module.exports = async (env, argv) => {
68
let config = {
79
entry: {
8-
bundle: path.resolve(__dirname, "bundle-config.js"),
10+
"bundle.min": path.resolve(__dirname, "index.js"),
911
},
1012
};
1113

1214
config = patternslib_config(env, argv, config);
1315
config.output.path = path.resolve(__dirname, "dist/");
1416

17+
config.plugins.push(
18+
mf_config({
19+
package_json: package_json,
20+
remote_entry: config.entry["bundle.min"],
21+
})
22+
);
23+
1524
if (process.env.NODE_ENV === "development") {
1625
config.devServer.static.directory = __dirname;
1726
}

0 commit comments

Comments
 (0)