timarney / react-app-rewired

Override create-react-app webpack configs without ejecting
MIT License
9.76k stars 425 forks source link

Getting error when integrating module federation Plugin #637

Open abhiseksubham opened 1 year ago

abhiseksubham commented 1 year ago

Hi,

I am using below code to install module federation plugin :

const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin"); console.log(ModuleFederationPlugin); module.exports = { webpack: function (config, env) { config.externals = function (context, request, callback) { if (/canvg|pdfmake/.test(request)) { return callback(null, "commonjs " + request); } callback(); }; // if (!config.plugins) { config.plugins = []; // } config.plugins.push( new ModuleFederationPlugin({ name: "app_1", filename: "remoteEntry.js", remotes: { app_2: "app_2@http://localhost:8081/remoteEntry.js", }, }) ); return config; }, };

However it throws an error saying "Cannot read properties of undefined (reading 'includes')".

Please help. if any integration examples with MF plugin, please provide those links.