Closed nahtnam closed 3 years ago
Have you tried keeping preact-ts
as it is, and add the aliases?
// vite.config.ts
export default {
+ alias: {
+ react: 'preact/compat',
+ 'react-dom': 'preact/compat'
+ }
}
It is working on my example repo when I use @tabler/icons
You need to install and alias to preact/compat
like @Schniz showed.
Thanks @Schniz @yyx990803! This is a much better developer experience than preact-cli
!
Is your feature request related to a problem? Please describe. I'm trying to use React components with the preact-ts example but I'm not sure how to do it
Describe the solution you'd like A way to set up preact/compat to use react components
Describe alternatives you've considered I created a repo with the
preact-ts
preset, installedreact
,react-dom
and@material-ui/core
and its types and changed thetsconfig.json
jsx
option topreserve
. Then I put a<Button
on the homepage and got this error:Uncaught DOMException: Failed to execute 'createElement' on 'Document': The tag name provided ('[object Object]') is not a valid name.
It didn't end up working so I'm not sure what to do.Additional context N/A