Created
January 2, 2022 09:46
-
-
Save nabeel-shakeel/697092e2fb583ec241e4ce1eb6569f50 to your computer and use it in GitHub Desktop.
Mirco-Frontend Container Webpack Configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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