Skip to content

chore: update @vitejs/plugin-react in examples and migrate to react compiler#761

Open
smeng9 wants to merge 2 commits into
module-federation:mainfrom
smeng9:react-compiler
Open

chore: update @vitejs/plugin-react in examples and migrate to react compiler#761
smeng9 wants to merge 2 commits into
module-federation:mainfrom
smeng9:react-compiler

Conversation

@smeng9
Copy link
Copy Markdown
Contributor

@smeng9 smeng9 commented May 29, 2026

Hi @gioboa

In latest version of React, it encourages the adoption of React Compiler https://react.dev/learn/react-compiler/introduction .

I have updated the example to support react compiler.

However I have one question regarding the shared dependency cache key, why is it different from the @module-federation/enhanced ones? This took almost an hour to figure out why the code is failing without the CACHE_KEY patch. For normal users they shouldn't need this setup for it to work.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 30, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@module-federation/vite@761

commit: 72fd916

Copy link
Copy Markdown
Collaborator

@gioboa gioboa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your help @smeng9

why is it different from the @module-federation/enhanced ones?

Can you elaborate more about this please?

@smeng9
Copy link
Copy Markdown
Contributor Author

smeng9 commented May 30, 2026

Can you elaborate more about this please?

If I don't perform the following then the host app will crash with an exception called useMemoCache is not defined when rendering the remote app. I am wondering why this step is needed if we already declare all the sharing in both host and remote.

if (globalThis[CACHE_KEY].share["react"] === undefined) {
  globalThis[CACHE_KEY].share["react"] = React;
}

@smeng9 smeng9 requested a review from gioboa May 30, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants