Created
January 2, 2022 09:54
-
-
Save nabeel-shakeel/2b3177632af4a209abfb82a65779e618 to your computer and use it in GitHub Desktop.
Webpack Configuration for Auth App
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.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