text: const HtmlWebpackPlugin = require("html-webpack-plugin");
  const { ModuleFederationPlugin } = require("webpack").container;
  const path = require("path");
  const deps = require("./package.json").dependencies;
  module.exports = {
    entry: "./src/index",
    mode: "development",
    devServer: {
      contentBase: path.join(__dirname, "dist"),
      port: 3002,
    },
    output: {
      publicPath: "http://localhost:3002/",
    },
    module: {
      rules: [
        {
          test: /\.jsx?$/,
          loader: "babel-loader",
          exclude: /node_modules/,
          options: {
            presets: ["@babel/preset-react"],
          },
        },
      ],
    },
    plugins: [
      new ModuleFederationPlugin({
        name: "app2",
        filename: "remoteEntry.js",
        remotes: {
          app1: "app1@http://localhost:3001/remoteEntry.js",
        },
        exposes: {
          "./Button": "./src/Button",
        },
        shared: [
          {
            ...deps,
            react: {
              // eager: true,
              singleton: true,
              requiredVersion: deps.react,
            },
            "react-dom": {
              // eager: true,
              singleton: true,
              requiredVersion: deps["react-dom"],
            },
          },
        ],
      }),
      new HtmlWebpackPlugin({
        template: "./public/index.html",
      }),
    ],
  };
  