-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Using NextFederationPlugin => Reached heap limit allocation failed #2047
Comments
Increase the memory heap: NODE_OPTIONS=--max-old-space-size=8192 next dev - give it more memory till it works. This plugin relies on hacks for next.js in them, one has to do with stats and data which seems to be inefficient on large builds (with ssr enabled) Workaround for it should be possible if you increase memory. |
Hi Zack, You are right and thank you for your suggestion. Actually, I knew I would get a successful build if I increased the max limit. In fact, I wonder if you are close to a permanent solution by finding the root cause of this problem and I wanted to give feedback if you are not aware of it. In addition, I think the problem can't be caused by SSR only because I don't use SSR in my large project. (no use getServerSideProps) Apart from all this, there is one more question I want to ask. Normally, I use the module in the remote application with next/dynamic in a nextjs project, but I wanted to share this usage through an npm package to be used in nextjs applications, but I cannot use next/dynamic in the npm package because I cannot specify that it should use the module in the remote application and I get the module not found error. Instead, I tried to use it with the injectScript I read in your documentation and I was successful. I wonder if there would be a performance difference between next/dynamic and injectScript. |
Inject script doesn't work with v8 use federation/runtime package. Can't use next/dynamic with MFP, use lazy We have shipped new data plugin but I've not replaced next implementation yet. |
Hi @ScriptedAlchemy, I'm also getting the same error while trying to build my nextjs project. Error:
Version of Version of Projects without module-federation package is building fine. I have tried increasing the memory like you have mentioned but it is even failing with Also tried increasing the memory to 16GB but it is even failing with Any suggestions would be appreciated. @eroldmrclk Were you able to find a solution to this problem? Any help would be appreciated. |
Stale issue message |
--max-old-space-size with no number will allow node to consume all memory needed. |
@ScriptedAlchemy, my app takes more than 30 Gigs memory to build with the plugin. Is it possible to suggest another workaround as using that much memory is not practical. |
@VisalakshiVairavan how big is the app that you need 30 Gigs of memory to build? Perhaps you will need to decompose it into smaller modules? |
Plugin needs to be rewritten. Even then no promise anything improves for next. |
Are there any plans to proceed with the rewrite of the plugin that was mentioned? If so, is there a timeline for when this might be implemented? |
Not currently. |
Warning Support for next is ending |
Describe the bug
Hello,
I would like to explain a problem I encountered during build time.
I can build a large project in a nextjs application with the “next build” command. I added the NextFederationPlugin in next.config.js in this application and run the “next build” command again. After a while I started to get the “reached heap limit allocation failed” error. At the build time, I see that the memory usage in the task manager increases significantly and eventually I get this error. I have tried the issue on several devices and I am sure it is not device related. The only difference between the successful build and the unsuccessful build is the NextFederationPlugin and it is difficult to understand why this occurs.
I did many different tests to find the source of the problem, but I could not reach a clear result. I guess this problem occurs because NextFederationPlugin changes webpack configurations. I can give the following information about the project. There are approximately 100 pages, each page is 1.4mb in size, use SSG (static site generation) and [email protected]. Additionally, when I reduced 100 pages in the project to 50 pages or 100 pages from 1.4mb to 500kb, I was able to get a successful build with NextFederationPlugin.
Is it a problem you've encountered before? Is there anything you can suggest?
Reproduction
Private
Used Package Manager
yarn
System Info
Validations
The text was updated successfully, but these errors were encountered: