Closed koengsen closed 2 years ago
Hi there! same error here :(
Just used CRA, installed CRACO and craco-module-federation. On craco start
get the same error:
TypeError: Cannot read properties of undefined (reading 'ModuleFederationPlugin')
at Object.overrideWebpackConfig (D:\Work\microfrontends-craco\app1\node_modules\craco-module-federation\index.js:43:31)
at overrideWebpack (D:\Work\microfrontends-craco\app1\node_modules\@craco\craco\lib\features\plugins.js:42:40)
at D:\Work\microfrontends-craco\app1\node_modules\@craco\craco\lib\features\plugins.js:64:29
at Array.forEach (<anonymous>)
at applyWebpackConfigPlugins (D:\Work\microfrontends-craco\app1\node_modules\@craco\craco\lib\features\plugins.js:63:29)
at mergeWebpackConfig (D:\Work\microfrontends-craco\app1\node_modules\@craco\craco\lib\features\webpack\merge-webpack-config.js:110:30)
at overrideWebpackDev (D:\Work\microfrontends-craco\app1\node_modules\@craco\craco\lib\features\webpack\override.js:11:36)
at D:\Work\microfrontends-craco\app1\node_modules\@craco\craco\scripts\start.js:27:5
craco.config.js
const cracoModuleFederation = require('craco-module-federation')
module.exports = {
devServer: {
port: 8081,
},
plugins: [
{
plugin: cracoModuleFederation,
},
],
}
modulefederation.config.js
const deps = require('./package.json').dependencies
module.exprots = {
name: 'app1',
filename: 'remoteEntry.js',
exposes: {
'./App1': './src/bootstrap',
},
shared: deps,
}
Hi there! same error here :(
Just used CRA, installed CRACO and craco-module-federation. On
craco start
get the same error:TypeError: Cannot read properties of undefined (reading 'ModuleFederationPlugin') at Object.overrideWebpackConfig (D:\Work\microfrontends-craco\app1\node_modules\craco-module-federation\index.js:43:31) at overrideWebpack (D:\Work\microfrontends-craco\app1\node_modules\@craco\craco\lib\features\plugins.js:42:40) at D:\Work\microfrontends-craco\app1\node_modules\@craco\craco\lib\features\plugins.js:64:29 at Array.forEach (<anonymous>) at applyWebpackConfigPlugins (D:\Work\microfrontends-craco\app1\node_modules\@craco\craco\lib\features\plugins.js:63:29) at mergeWebpackConfig (D:\Work\microfrontends-craco\app1\node_modules\@craco\craco\lib\features\webpack\merge-webpack-config.js:110:30) at overrideWebpackDev (D:\Work\microfrontends-craco\app1\node_modules\@craco\craco\lib\features\webpack\override.js:11:36) at D:\Work\microfrontends-craco\app1\node_modules\@craco\craco\scripts\start.js:27:5
craco.config.js
const cracoModuleFederation = require('craco-module-federation') module.exports = { devServer: { port: 8081, }, plugins: [ { plugin: cracoModuleFederation, }, ], }
modulefederation.config.js
const deps = require('./package.json').dependencies module.exprots = { name: 'app1', filename: 'remoteEntry.js', exposes: { './App1': './src/bootstrap', }, shared: deps, }
Did you update react-scripts to version 5?
Hey thank you for this project :)
I have a remote app with a
craco.config.js
including aand when I am creating a
modulefederation.config.js
to add the options I am getting an error, when doing
yarn start
.Doesn't matter if the modulefederation config file is empty or not.
Any idea what's wrong here?