Skip to content

Instantly share code, notes, and snippets.

@nabeel-shakeel
Created January 2, 2022 09:54
Show Gist options
  • Save nabeel-shakeel/2b3177632af4a209abfb82a65779e618 to your computer and use it in GitHub Desktop.
Save nabeel-shakeel/2b3177632af4a209abfb82a65779e618 to your computer and use it in GitHub Desktop.
Webpack Configuration for Auth App
const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
const { dependencies } = require('../../../package.json');
module.exports = (config, context) => {
config.context = process.cwd();
config.plugins.push(
new ModuleFederationPlugin({
name: 'auth',
filename: 'remoteEntry.js',
exposes: {
'./AuthApp': 'apps/auth/src/bootstrap',
},
shared: {
...dependencies,
},
})
);
config.optimization.runtimeChunk = false;
config.output = {
uniqueName: 'auth',
publicPath: 'http://localhost:8082/',
clean: true,
};
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