webpack module federation issue
Budget: ₹600 – ₹1,500 INR
My microfrontend react application is created using Nx Tool.
Below was my webpack config & when starting the app, I'm getting error that
TypeError: fn is not a function
while loading "./Module" from 8640
const { ModuleFederationPlugin } = require('webpack').container;
const nrwlConfig = require('@nrwl/react/plugins/webpack.js');
module.exports = (config, context) => {
nrwlConfig(config);
return {
...config,
plugins: [
...config.plugins,
new ModuleFederationPlugin({
name: 'cart',
filename: 'remoteEntry.js',
exposes: {
'./Module': './src/remote-entry.ts',
},
}),
],
};
};
Things I had tried:
There is a description in the webpack doc, but I wasnt able to understand what needs to be done.
Steps to replicate:
Code exists here: https://stackblitz.com/edit/react-ts-azwv9t or get from GIT:https://github.com/kalingaCoder/React_nx_2
Do npm install
Do npm run start
Open http://localhost:4200/cart with dev console open
Files to check:
apps\cart\webpack.config.js
Below was my webpack config & when starting the app, I'm getting error that
TypeError: fn is not a function
while loading "./Module" from 8640
const { ModuleFederationPlugin } = require('webpack').container;
const nrwlConfig = require('@nrwl/react/plugins/webpack.js');
module.exports = (config, context) => {
nrwlConfig(config);
return {
...config,
plugins: [
...config.plugins,
new ModuleFederationPlugin({
name: 'cart',
filename: 'remoteEntry.js',
exposes: {
'./Module': './src/remote-entry.ts',
},
}),
],
};
};
Things I had tried:
There is a description in the webpack doc, but I wasnt able to understand what needs to be done.
Steps to replicate:
Code exists here: https://stackblitz.com/edit/react-ts-azwv9t or get from GIT:https://github.com/kalingaCoder/React_nx_2
Do npm install
Do npm run start
Open http://localhost:4200/cart with dev console open
Files to check:
apps\cart\webpack.config.js