Code Monkey home page Code Monkey logo

Comments (21)

ScriptedAlchemy avatar ScriptedAlchemy commented on August 17, 2024 2

Thanks I'll take a look and my pull in some of my ByteDance infra engineers who are well versed in low level runtime stuff.

This might solve it. We will see. But I'm very close to releasing v1.5 of federation where we have made significant upgrades and added new runtime APIs. Once it lands I'll rework next.js plugin into of these new APIs and see how much of next plugin is still needed. #1623

from universe.

ScriptedAlchemy avatar ScriptedAlchemy commented on August 17, 2024 1

@ChrisCantThinkOfAUsername you can try https://www.npmjs.com/package/@module-federation/nextjs-mf/v/0.0.0-feat-node-support-1703050615268 which is using the new v1.5 module-federation/enhanced plugin and federation/runtime packages

0.0.0-feat-node-support-1703050615268

from universe.

tathje avatar tathje commented on August 17, 2024 1

Thanks for creating this plugin!

I have same problem. any update for this issue?
Package versions:
"next": "13.1.6",
"react": 18.2.0,
"@module-federation/nextjs-mf": "^8.1.3"
I see most of the storage inside .next/cache/webpack. In my case, ~800MB without this plugin and ~7GB using it

from universe.

ScriptedAlchemy avatar ScriptedAlchemy commented on August 17, 2024 1

This issue likely resides in the chunk correlation plugin which iterates over a large amount of stats data.
If it does away when not applied client side then its probs the stats stuff.

As a workaround, increase heap size of node. We will replace the stats plugin this quarter i believe

from universe.

ScriptedAlchemy avatar ScriptedAlchemy commented on August 17, 2024

try v8, its on the canary tag on npm.

from universe.

ChrisCantThinkOfAUsername avatar ChrisCantThinkOfAUsername commented on August 17, 2024

Thanks for your response!

On 8.1.0-canary.5, I needed to manually set process.env.NEXT_PRIVATE_LOCAL_WEBPACK = 'true', and after that, I saw "Uncaught Error: Shared module is not available for eager consumption" for packages that are not direct dependencies of my app. This was not something I encountered on 7.0.8.

As for the heap out of memory issue, it seems to be correlated with importing large packages (ie ones that do not tree shake) in many pages. Two separate things I tried were lazy loading such packages, and disabling SSR for as much of my app as possible using https://www.npmjs.com/package/react-no-ssr, and while First Load JS for each page dropped 75%, I'm still unable to successfully build the app without deleting a subset of pages.

Are there any steps you would recommend taking to debug the next build process, or NextFederationPlugin's impact on it?

from universe.

ChrisCantThinkOfAUsername avatar ChrisCantThinkOfAUsername commented on August 17, 2024

Hi @ScriptedAlchemy, I was able to get 8.1.0-canary.1 to run, but production builds still cause a heap overflow.

from universe.

ChrisCantThinkOfAUsername avatar ChrisCantThinkOfAUsername commented on August 17, 2024

@ScriptedAlchemy Repro: https://github.com/ChrisCantThinkOfAUsername/nextjs-v13-heap-issue-repro

from universe.

ScriptedAlchemy avatar ScriptedAlchemy commented on August 17, 2024

bump

from universe.

ChrisCantThinkOfAUsername avatar ChrisCantThinkOfAUsername commented on August 17, 2024

Thanks @ScriptedAlchemy; I will retest once the next @module-federation/nextjs-mf canary build is published and report back

from universe.

ChrisCantThinkOfAUsername avatar ChrisCantThinkOfAUsername commented on August 17, 2024

bump

from universe.

ChrisCantThinkOfAUsername avatar ChrisCantThinkOfAUsername commented on August 17, 2024

@ScriptedAlchemy Still seeing heap overflow on 0.0.0-feat-node-support-1703050615268 unfortunately. I'll just disable federation for the server build in the meantime.

from universe.

ScriptedAlchemy avatar ScriptedAlchemy commented on August 17, 2024

It's probably the chunk correlation plugin which is quite intense. Can you increase memory limit of node? Max old space

from universe.

asifgeekologix avatar asifgeekologix commented on August 17, 2024

Hello,
i am facing an issue with the Production environment. Currently i am using
Next.js version: 13.5.6
React version: 18
@module-federation/nextjs-mf: 7.0.8
webpack: 5.89.0

When i try with next dev it's working fine but when i create a build and try with next start. it will not work.
And getting this error:

Screenshot 2024-01-02 at 10 28 14 AM

Please let me know if have any solution

from universe.

bayleymauger avatar bayleymauger commented on August 17, 2024

Hi,

Firstly, thank you for your efforts on the plugin – it has greatly enhanced the community's capabilities.

I find myself in a situation similar to @ChrisCantThinkOfAUsername, but we're working with a lower version of Next.js. Currently, we're undertaking the challenge of transitioning from a heavily bloated legacy Next.js application to multiple micro frontends. Unfortunately, due to certain constraints, we can't follow the conventional approach of rebuilding from the outside in (shell first and micro frontends under a new shell). Instead, we have to adopt an inside-out strategy, relying on the legacy Next.js application with new micro frontends loaded inside. During this process, we've encountered an issue when attempting to incrementally adopt module federated apps within the legacy application.

Here are our package versions:

  • next: 12.3.4
  • react: 18.2.0
  • @module-federation/nextjs-mf: 7.0.8 (we've also tried the latest next tags without success)

Our attempts to address the issue included increasing the node memory limit, which proved effective in a local environment. However, our CI environment imposes memory limitations that prevent us from implementing the necessary memory bump.

If you require additional information or if providing dumps would be helpful, please let me know. Your assistance is much appreciated!

Thanks!

from universe.

ohdonguri avatar ohdonguri commented on August 17, 2024

Hello!

I have same issue and solve
however, there is side issue.

version info:
react: 17.0.2
next: 12.2.2
nextjs-mf: 7.0.8

my solution is increase node heap size.
NODE_OPTIONS=--max_old_space_size=4096

but, allocate more heap size, jenkins build time increase too. almost 90 seconds ...

so, I have some question

  1. Is there other better solution?
  2. Is this issue safe on runtime?
  3. when build host app, nextjs-mf plugin create chunk files to use host as remote ? (docker image size increase 24M)

Thanks!

from universe.

ScriptedAlchemy avatar ScriptedAlchemy commented on August 17, 2024

issue wont exist at runtime. The problem is related to build and that i have to loop over large amount of data in compiling to construct correlations. I may improve heap issue when switch over to #2108

from universe.

duannx avatar duannx commented on August 17, 2024

Hi @ScriptedAlchemy, does this issue only appear with nextjs-mf: 7.0.8 or with nextjs-mf: 8 as well?

from universe.

tathje avatar tathje commented on August 17, 2024

solved by setting webpack config.cache = false in next.config.js but I don't think it's a good solution

from universe.

ScriptedAlchemy avatar ScriptedAlchemy commented on August 17, 2024

Issue exists since v1 of next mf.

Increase memory heap.

from universe.

github-actions avatar github-actions commented on August 17, 2024

Stale issue message

from universe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.