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

[React][Vite] ReferenceError: React is not defined. Disclosure component #1754

Closed
valkedev opened this issue Aug 10, 2022 · 2 comments
Closed

Comments

@valkedev
Copy link

@headlessui/react v1.6.6 Chrome

There is a problem with Discloture component.

I use Vite with React and experience this kind of error:

index.25fddd55.js:46 ReferenceError: React is not defined
    at index.25fddd55.js:67:21695
    at Ch (index.25fddd55.js:44:57576)
    at gi (index.25fddd55.js:44:66437)
    at ck (index.25fddd55.js:48:11909)
    at bk (index.25fddd55.js:48:1039)
    at ak (index.25fddd55.js:48:962)
    at Tj (index.25fddd55.js:48:803)
    at Lj (index.25fddd55.js:46:11940)
    at index.25fddd55.js:44:41737
    at rt.unstable_runWithPriority (index.25fddd55.js:33:4130)

Found solution in node_modules/@headlessui/react/dist/components/disclosure/disclosure.js on 1:2208:
instead of t.as===y.Fragment i used t.as===j because you're already import Fragment as j in this file and problem solved for me.

Maybe i did something wrong but i really want a quick solution for that.

Thant you.

@valkedev valkedev changed the title [React]: ReferenceError: React is not defined [React] ReferenceError: React is not defined Aug 10, 2022
@valkedev valkedev changed the title [React] ReferenceError: React is not defined [React] ReferenceError: React is not defined. Disclosure component Aug 10, 2022
@valkedev valkedev changed the title [React] ReferenceError: React is not defined. Disclosure component [React][Vite] ReferenceError: React is not defined. Disclosure component Aug 10, 2022
@RobinMalfait
Copy link
Member

Hey! Thank you for your bug report!
Much appreciated! 🙏

This is a vite problem, and not a Headless UI problem. However, we have an improvement that seems to solve this as well implemented here: #1693

You should be able to use the insiders build to "fix" this problem.

You can already try it using npm install @headlessui/vue@insiders.

@valkedev
Copy link
Author

@RobinMalfait Heya!
It helped! Thank you!

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

No branches or pull requests

2 participants