-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
Error: NextJS MFE plugin throws error with experimental app directory enabled #799
Comments
May be helpful info. What I found is that the minute I add the app directory the whole app starts falling. If it has a custom webpack config like the above. |
App directory is not currently supported. After the v7 rewrite, I’ll look into it. There were a few complications I needed to think about. But it should be solvable in a feature release on v7.1 |
Is there any way, by we can add remotes in appDir |
You can branch and try it. I'd suggest trying the async boundary PR branch if you want to pr me with a broken example |
Hey @ScriptedAlchemy, do you have an ETA on app directory support, or might be even support it at v6 as fix ? |
@ScriptedAlchemy Do you have a specific month for when you will support the app directory? |
Related to #619 |
App Router is stable since May 2023 |
hey @ScriptedAlchemy |
hey @ScriptedAlchemy |
Modernjs will get this in near future most likely (RSC + MF) Next is unknown at this point in time. If we can backport what we do in modernjs then it will provide some clarity. If not then it's an unknown. But my gut says don't expect and movement here for several months. If that estimate changes then I'll pin a git issue. Modernjs has significantly better support and DX for MFE. It might be recycled for other ecosystems, might* But, so far - it usually only takes a few weeks what takes a few months to support in next |
Modernjs is fine and dandy... but I believe NextJS is the de-facto standard, with the biggest English speaking community and should be supported :) |
I get the point about Next.js having a large community, but there are several technical and strategic factors that warrant attention:
In summary, ModernJS and its next iteration, are designed to focus on challenges often encountered at scale, such as horizontal scaling, iteration speed, and cloud costs. Like vercel, we own both our meta-framework and an optional Rust compiler, Rspack, which is interoperable with Webpack. This setup allows us to innovate and contribute back to the broader Webpack ecosystem. I'll continue to maintain the Next.js plugin, recognizing the complexities of enterprise change management and my moral obligation to a userbase that includes industry giants like Microsoft, AWS, and Netflix. However, my focus is shifting to ModernJS. I plan to make it modular to resolve specific issues in Next.js federation, enabling the export of features like TypeScript syncing, full dynamic remotes, an SDK, fast refresh and HMR, and memory-efficient server-side federation with production (server) HMR. The efficiency gain with ModernJS is notable: what took three years in Next.js took only three months in ModernJS. The meta-framework offers opt-in features like self-healing runtimes, built-in solutions for documentation, self-discovery, Storybook discovery, npm authoring, state management, and runtime lockfiles. These features are designed to integrate well if combined but are not coupled to a larger stack you have to buy into. Given the extraordinary measures I've gone to for the Next.js federation plugin, where I've replaced a significant amount of Webpack's internal runtime and even implemented my own chunk and dependency management over the module graph, I've contemplated more creative solutions. One such idea is to mock the Next.js API and have my plugin resolve to ModernJS internally, effectively replacing Next.js completely. This is not far-fetched considering l replaced large parts of Webpack's internal runtime already, and drastically alter the build config. My aim is to un-stall my ecosystem, which feels like it's been held back due to the time and resources spent on Next.js. The short term options for next are:
|
Great insights. Appreciate it! Disclaimer; you work for ByteDance...? However, an extensive user base is different from a big community. That being said, I'm looking forward to following ModernJS, EdenX, and Nextjs-MF going forward :) |
Yes I did join recently. Mainly because I really liked the experience and wanted to bring it to a wider audience, as it's solved hard problems that I've been stuck on for a long time. From what users open issues for, it's addressed many. Overall I'm positive for the broader ecosystem. Implementing it somewhere easy makes implementing elsewhere less hard |
Lastly, with that said :) the consulting wing of the federation org does have a request to investigate App Router. Which would push back into universe. Between the federation org and byte infra. It we will solve RSC, but may require forking some RSC loader/plugins. But next has custom ones and it's harder to replace |
Is this problem resolved because I am using version 8.3.4 and still not working it's saying @ScriptedAlchemy Error: App Directory is not supported by nextjs-mf. Use only pages directory, do not open git issues about this |
App directory will not be supported. Vercel is developing a proprietary solution for RSC "federation" and will likely lock me out of being able to support it. |
Is there any public information regarding this Vercel RSC "federation"? |
@matsgm other than a single tweet from @rauchg there has not been anything that I've seen. In conversations with @leerob and @elsigh they both let me know that this is still work in progress. My personal hope is that the Vercel team will work with the community to make what they are working on compatible with federation enhanced since it is bundler agnostic. It already works with webpack and with Rust bundler Rspack and will soon be working with Vite via Rolldown (also Rust) thanks to @yyx990803. That would leave Turbopack the only major bundler without support of Module Federation which would be great to resolve. |
Hi, any news about when we can expect the MF support for app directory? |
Any news? Same problem in 10/7/2024 |
Any news? I've been following this issue for a year! 💀 |
No R&D has been allocated. |
NextJS latest with Experimental App directory enabled breaks during build with NextJS Mfe plugin
I tried @module-federation/nextjs-mf": "^6.4.0 plugin with the latest NextJS that has a new way of making pages.
For monorepo setup I used turborepo
To use the app directory below settings need to be added in next.config.js
And finally to enable the nextjs-mf plugging I modified the next.config.js like below
The project just builds fine I just comment the webpack config but it failed with below error code when tried with above settings.
Steps to reproduce
yarn
cd apps/mfe-remote/
yarn build
The text was updated successfully, but these errors were encountered: