Skip to content
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

fix: support react compiler runtime #2682

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

stipsan
Copy link

@stipsan stipsan commented Dec 17, 2024

WHY are these changes introduced?

react-compiler-runtime is published by the react core team, and needs to be handled the same way as react/jsx-runtime. Same goes for the new react 19 react/compiler-runtime entrypoint.
We did the same fix for Astro: withastro/astro#12735

WHAT is this pull request doing?

Just adds CJS to ESM optimizations to the vite pipeline for React Compiler

HOW to test your changes?

I don't know if you have a React Compiler pipeline setup, but at Sanity we publish a range of libraries that publish code using react-compiler-runtime that you can test:

  • react-rx
  • @portabletext/editor
  • @sanity/visual-editing/remix

Post-merge steps

Not really, this is part of the public API of supporting React and is just expected by consumer will work.

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

@wizardlyhel
Copy link
Contributor

@stipsan Couldn't this vite optimize dependency addition be part of vite.config.ts on individual projects? and also part of using Sanity library instruction?

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