I am using nextjs@14 version.
here is my next.config.mjs
export default (phase, { defaultConfig }) => {
//console.log('defaultConfig =>', defaultConfig);
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
...defaultConfig,
webpack(config, { isServer }) {
config.plugins.push(
new ModuleFederationPlugin({
name: 'remoteApp',
filename: 'static/remoteEntry.js',
exposes: {
'./Button': './pages/components/Button',
// Add more components as needed
},
shared: {
react: { singleton: true, eager: true },
'react-dom': { singleton: true, eager: true },
}
})
)
return config;
}
}
return nextConfig
}
I am facing below error
[email protected] dev next dev
▲ Next.js 14.2.16
- Local: http://localhost:3000
✓ Starting... TypeError: The 'compilation' argument must be an instance of Compilation at ModuleFederationPlugin.getCompilationHooks (D:\development\shell-app3\node_modules\webpack\lib\container\ModuleFederationPlugin.js:58:10) at D:\development\shell-app3\node_modules\webpack\lib\container\HoistContainerReferencesPlugin.js:36:33 at Hook.eval [as call] (eval at create (D:\development\shell-app3\node_modules\next\dist\compiled\webpack\bundle5.js:13:28636), :35:1) at Hook.CALL_DELEGATE [as _call] (D:\development\shell-app3\node_modules\next\dist\compiled\webpack\bundle5.js:13:25906) at Compiler.newCompilation (D:\development\shell-app3\node_modules\next\dist\compiled\webpack\bundle5.js:28:147853) at D:\development\shell-app3\node_modules\next\dist\compiled\webpack\bundle5.js:28:148673 at Hook.eval [as callAsync] (eval at create (D:\development\shell-app3\node_modules\next\dist\compiled\webpack\bundle5.js:13:28858), :6:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (D:\development\shell-app3\node_modules\next\dist\compiled\webpack\bundle5.js:13:26012) at Compilerpile (D:\development\shell-app3\node_modules\next\dist\compiled\webpack\bundle5.js:28:148599) at D:\development\shell-app3\node_modules\next\dist\compiled\webpack\bundle5.js:28:491794