Comments (21)
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.
@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.
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.
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.
try v8, its on the canary
tag on npm.
from universe.
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.
Hi @ScriptedAlchemy, I was able to get 8.1.0-canary.1 to run, but production builds still cause a heap overflow.
from universe.
@ScriptedAlchemy Repro: https://github.com/ChrisCantThinkOfAUsername/nextjs-v13-heap-issue-repro
from universe.
bump
from universe.
Thanks @ScriptedAlchemy; I will retest once the next @module-federation/nextjs-mf canary build is published and report back
from universe.
bump
from universe.
@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.
It's probably the chunk correlation plugin which is quite intense. Can you increase memory limit of node? Max old space
from universe.
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](https://private-user-images.githubusercontent.com/92726056/293629015-8f11711e-c4d8-4203-b022-8b22c7a31e68.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2MjQwMTksIm5iZiI6MTcxOTYyMzcxOSwicGF0aCI6Ii85MjcyNjA1Ni8yOTM2MjkwMTUtOGYxMTcxMWUtYzRkOC00MjAzLWIwMjItOGIyMmM3YTMxZTY4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDAxMTUxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ4YmJjZDljMDZiYzUzMTZmNDhjNzVlNmIxYTBkZjQzYmUyOGVhOWRhN2MyZDYwOTg0ZjU4MjM4MTAxNjZlNTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.zBf00hUJsotq7m4Uv_109LzWoYjCX0Feb2qsVbiFm0w)
Please let me know if have any solution
from universe.
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.
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
- Is there other better solution?
- Is this issue safe on runtime?
- when build host app, nextjs-mf plugin create chunk files to use host as remote ? (docker image size increase 24M)
Thanks!
from universe.
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.
Hi @ScriptedAlchemy, does this issue only appear with nextjs-mf: 7.0.8
or with nextjs-mf: 8
as well?
from universe.
solved by setting webpack config.cache = false
in next.config.js
but I don't think it's a good solution
from universe.
Issue exists since v1 of next mf.
Increase memory heap.
from universe.
Stale issue message
from universe.
Related Issues (20)
- Optimizing the problem of overly long identifiers of the container entry module of the issuerPath in the stats.json file HOT 2
- @module-federation/native-federation-typescript - support destination folder, loadRemote typings and other improvements HOT 7
- Type file missing when using vue-tsc HOT 10
- remote component error in react when this version different HOT 5
- Add documentation / example for including module federation runtime via CDN in browser script tag HOT 4
- Module Federation not working with Content Security Policy (CSP) HOT 9
- getPublicPath or publicPath is not part of ModuleFederationPluginOptions HOT 5
- @mf-types. expose typings for shared modules HOT 1
- Infer shared modules based from the host's manifest file. HOT 2
- Duplicate network request for chunk from multiple entryfiles HOT 6
- Module Federation SSR is incompatible with webpack-node-externals HOT 2
- The remote module is missing on the Window when running in the sandbox of the micro-frontend framework micro-app. HOT 5
- i try to use init() and app cant find it HOT 4
- Using the `revalidate` method to trigger hot reload can cause service crashes HOT 5
- dts for entries exposed with aliases are not emitting HOT 1
- Can't create Error Fallback when any Remote fails. HOT 9
- Chrome Extension is not working due to empty `moduleInfo` HOT 3
- web worker error in host HOT 2
- Exact matching alias does not work as expected in bridge webpack plugin HOT 2
- Shared dependency version cannot be resolved if installed at root of a monorepo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from universe.