Skip to content

Instantly share code, notes, and snippets.

@nabeel-shakeel
Created January 2, 2022 09:46
Show Gist options
  • Save nabeel-shakeel/697092e2fb583ec241e4ce1eb6569f50 to your computer and use it in GitHub Desktop.
Save nabeel-shakeel/697092e2fb583ec241e4ce1eb6569f50 to your computer and use it in GitHub Desktop.
Mirco-Frontend Container Webpack Configuration
const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
const { dependencies } = require('../../../package.json');
module.exports = (config, context) => {
config.plugins.push(
new ModuleFederationPlugin({
name: 'container',
remotes: {
auth: 'auth@//localhost:8082/remoteEntry.js',
dashboard: 'dashboard@//localhost:8083/remoteEntry.js',
},
shared: {
...dependencies,
},
})
);
config.output.publicPath = 'http://localhost:8081/';
config.module.rules = [
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
{
test: /\.(js|tsx|ts)$/,
use: {
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-react',
'@babel/preset-env',
'@babel/preset-typescript',
],
plugins: ['@babel/plugin-transform-runtime'],
},
},
},
];
return config;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment