-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React Module Federation is broken from 15.4.6+ #14629
Comments
Workaround: Goto to your app folder and edit module-federation.config.js From
To
|
There is a Something like this should work until we patch it in the next release.
|
I updated this in my remote. The project did build this time, but the error is still happening on my end now in the host also when I try to run the command 'pnpm nx serve host --devRemotes dashboard' ERROR in ./apps/host/src/app/app.tsx 6:48-74 webpack compiled with 1 error (198da9a27f713c31) I also just tried adding the context config @jaysoo with no change in the error. |
Try this in the host. There is a problem handling the
|
Currently removing the devkit is creating errors. Seems that there are a lot of changes happening from that upgrade creating breaking changes. Is there documentation for updating from 15.50 to 15.6. So as not to cross error conversations @jaysoo. |
You should be able to use these configs. Host:
Remote:
|
See here https://github.com/jaysoo/issue14629 We should be able to patch it today. Updated docs for webpack config: https://nx.dev/packages/webpack/documents/webpack-config-setup (we're still working on more docs). |
Fix this here #14653 |
Thank you for the fast turnaround on this @jaysoo! Two questions for you:
|
|
Ok, great thank you again! |
@jaysoo Thank you so much for your quick responses and turn around time. I also figured out one of the issues that may be happening as well. When you install a new workspace, there are no polyfills being created. In the example you provided, it does have them. I tried creating an empty workspace as well as an integrated one, then creating the host and remote dashboard. So if someone is starting from scratch, it will cause issues. Just wanted to point that out. There may be other files, but I stopped there when I came across that. |
@jonesy212 The polyfills are not generated by default anymore. Modern browsers don't require them. We'll write a guide for how to enable polyfills for those that need them, but they aren't required for module federation to work. 15.6.3 is released and module federation is working with it. Following the guide is working again. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
With the recent changes in this release (https://github.com/nrwl/nx/releases/tag/15.4.6) specifically these 3:
webpack: generate React and Web apps with webpack.config.js file (feat(webpack): generate React and Web apps with webpack.config.js file #14285) (454fba4)
webpack: remove support for legacy browsers (feat(webpack): remove support for legacy browsers #14190) (fcc02d1)
webpack: remove support for legacy browsers (feat(webpack): remove support for legacy browsers #14190) (feat(webpack): remove support for legacy browsers (#14190) #14257) (6feb56e)
It seems that module federation serving and building is broken because the
withModuleFederation
method has not been refactored to take into account the change that happened with regards togetWebpackConfig
->withReact
and the latter now returning a function instead of just a config object.As a result, the building and serving of both host and remote applications throw errors like the following:
This file likely needs to be updated: https://github.com/nrwl/nx/blob/master/packages/react/src/module-federation/with-module-federation.ts as well as documentation around how to use the new methods like
withReact
,withWeb
,withNx
andcomposePlugins
if they should be used directly at all. The only information I found on this was within other issues or the pull requests themselves. Even the release notes are pretty limited on descriptive information about this change.Expected Behavior
I expect module federation builds and serving to continue working as it previously had as there were no documented breaking changes to this functionality after 15.4.5
GitHub Repo
No response
Steps to Reproduce
Set up a module federation project just as described here: https://nx.dev/recipes/module-federation/faster-builds and it will no longer work on any version of Nx after 15.4.5.
Nx Report
Failure Logs
Additional Information
No response
The text was updated successfully, but these errors were encountered: