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: handle using compiler with React 18 #330

Merged
merged 2 commits into from
Jun 10, 2024
Merged

Conversation

ArnaudBarre
Copy link
Member

Fix #328

@ArnaudBarre ArnaudBarre added the bug Something isn't working label May 28, 2024
@ArnaudBarre ArnaudBarre self-assigned this May 28, 2024
@ArnaudBarre
Copy link
Member Author

I'm surprised vite build just let the require from a local package without type: module pass though like this, feel like a bug in Vite.

Copy link
Collaborator

@hi-ogawa hi-ogawa left a comment

Choose a reason for hiding this comment

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

I'm surprised vite build just let the require from a local package without type: module pass though like this, feel like a bug in Vite.

I just ran locally and I get what you mean. I think I've seen something similar when my transform plugin accidentally injected export ... into react cjs package which had require. (I actually I wasn't sure at that time, but now seeing this issue, I'm guessing that was the case.)

Not sure why React team wrote that, but I think we can simply pick esm or cjs? I'll comment what I tested locally.

@ArnaudBarre
Copy link
Member Author

Yeah for sure using ESM is good solution, but the official gist provided by @poteto uses require so other people maybe have trouble with it?

@poteto are you ok with changing your gist to use ESM syntax? I think all frameworks/toolchains support it

@poteto
Copy link

poteto commented May 29, 2024

yeah either works, the gist is just a reference

@wong2
Copy link

wong2 commented Jun 9, 2024

Any updates?

@ArnaudBarre
Copy link
Member Author

@poteto yeah I know but default matters and I think that 9 years after ESM being spec, using them for client code will be better than an import style that never worked in browsers.

@ArnaudBarre ArnaudBarre merged commit ea647d1 into main Jun 10, 2024
7 checks passed
@ArnaudBarre ArnaudBarre deleted the fix-compiler-react-18 branch June 10, 2024 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The 4.3.0 version break React compiler setup
4 participants