"@prefresh/vite" fails when using "jsxFactory" other than "h" from "preact"
See original GitHub issueProblem
Emotion users need to be able to use a custom jsxFactory
, when using one of the core features of emotion css prop.
When making this change (click to view)
Switching from the suggested:
esbuild: {
jsxFactory: `h`,
jsxFragment: `Fragment`,
jsxInject: `import { h, Fragment } from "preact";`,
},
To:
esbuild: {
jsxFactory: `jsx`,
jsxInject: `import { jsx } from "@emotion/react";`,
},
The "@prefresh/vite"
fails with the following error message:
- I’m new to vite, so sorry for not being able to provide you w/ a more useful debug msg
Cannot read property '__e' of undefined
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
TypeScript | Preact: Fast 3kb React alternative with the same ...
Using ref with any other element lets TypeScript thrown an error: import { h, Component, createRef } from "preact"; class Foo extends Component...
Read more >import { h } from preact - when is it necessary - Stack Overflow
My understanding was that wherever I have a component defined with JSX, I need to have import { h } from 'preact' at...
Read more >Vite with Preact and TypeScript - fettblog.eu
jsx to preserve , which means that TypeScript doesn't compile JSX. This is done by Vite anyway · jsxFactory is h . This...
Read more >cannot read properties of undefined (reading '__h') - You.com
Invalid hooks call when using widget built with preact inside react app ... of undefined (reading '__H')' and the other is 'preact Uncaught...
Read more >Moving React app to Preact in 10 minutes with Vite - Puru Vijay
#Is it true? In case you are wondering if my claim of moving an app this big from one framework to other in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Btw, as crazy as it sounds, the following addition ended up working. If you add more deps to the exclusion, vite/esbuild stops working properly throwing different errors related to the exports of the pkgs.
I’ll be closing it, as I don’t have any issues w/ the above.
I see, and the “Cannot read __H of undefined” now shows up when I try to add the exclusions, as mentioned earlier:
So it sounds like an issue with Vite that can/should be fixed on their end?
EDIT: After removing this from my config and rerunning the dev server… the error went away 🤔 huh. Curious. There must be some non-determinism at play here