const path = require ( 'path' ) ; const { ModuleFederationPlugin } = require ( 'webpack' ) . container ; type { import ( 'webpack' ) . Configuration } module . exports = { entry : './src/index' , mode : 'production' , target : 'web' , devtool : false , output : { libraryTarget : 'system' , libraryExport : 'main' , publicPath : 'http://localhost:5001/' } , optimization : { } , module : { rules : [ { test : /\.jsx?$/ , loader : 'babel-loader' , exclude : /node_modules/ , options : { presets : [ '@babel/preset-react' ] } } ] } , plugins : [ new ModuleFederationPlugin ( { name : 'rwebpackremote' , library : { type : 'system' } , filename : 'remoteEntry.js' , exposes : { './Button' : './src/Button' } , shared : { react : { requiredVersion : '^16.12.0' } , 'react-dom' : { requiredVersion : '^16.12.0' } } } ) ] , devServer : { static : { directory : path . join ( __dirname ) } , port : 5001 , headers : { 'Access-Control-Allow-Origin' : '*' , 'Access-Control-Allow-Methods' : 'GET, POST, PUT, DELETE, PATCH, OPTIONS' , 'Access-Control-Allow-Headers' : 'X-Requested-With, content-type, Authorization' } } } ;