NextJS Plugin not working with Webpack v5.22.0 and up
I'm not sure if it's best to file this here, in the example repo, or in the webpack repo, let me know if there's a better place for this.
I've been unable to get module federation working with the latest version of NextJS, which is using wepback 5.24.4. The explanation below uses the nextjs example at https://github.com/module-federation/module-federation-examples/tree/master/nextjs.
When running the example in the nextjs folder, I get ReferenceError: next1 is not defined. It seems that next1 is not set as a global variable in the browser.
Though the package.json has resolutions to set the Webpack version to 5.18.0, when the webpack5 flag in nextjs is set, it ignores the resolution version and instead pulls in version 5.24.4 (you can see this by adding console.log(options.webpack.version) to the webpack function in next.config.js.
I did some testing with different version of Webpack 5 (using resolutions and an older version of nextjs before they added the webpack5 flag, you can test this in the example repo by removing the caret in front of the dependency next: "^10.0.0"), and determined that the last working version without this error was 5.21.2. Looking at the remoteEntry files that are emitted using v5.21.2 vs v5.22.0, I see that the global variable assignment is missing from the generated remoteEntry file after v5.22.0.
Working - Webpack v5.21.2:

Not working - Webpack v5.22.0

That's as far as I've been able to trace things, I looked through Webpack's 5.22.0 release but didn't see anything obvious. I've also not been able to find a way to actually override the version of webpack 5 in the most recent version of nextjs. I'd really like to adopt module federation in our nextjs apps. Let me know if there's any more info you need. Thanks!
I've a very similar error with that repo :(

I ran into the same issue. For me, the MergeRuntime command kept failing. All it does is combine these 2 together, which you need both in order to fetch the remote host. If you only load in the remoteEntry script then you'll get the above error every time.
<script src={`${process.env.APP_A_URL}/_next/static/chunks/webpack.js`}></script>
<script src={`${process.env.APP_A_URL}/_next/static/runtime/remoteEntry.js`}></script>
have updated merge runtime