drei: Rendering Html-Element breaks app with "missing react-dom" error although react-dom is installed
three
version: 0.132.2@react-three/fiber
version: 7.0.7@react-three/drei
version: 7.8.0node
version: 16.9.1npm
(oryarn
) version: 7.21.1
Problem description:
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 24 (19 by maintainers)
Commits related to this issue
- fix: drei Html failing in build see https://github.com/pmndrs/drei/issues/557 — committed to nicolasgargano/wave by nicolasgargano 3 years ago
this was closed with f6ad92a
Btw, I asked one guy who knows a lot about bundlers on twitter and he basically said “just use different entrypoints” (https://twitter.com/IAmTrySound/status/1442412936073523200) Which drei already uses (web and native), it’s just the web is a default one, and having to use
/native
(and for all imports no less) because I don’t havereact-dom
is pretty confusing IMOIf we can consider a breaking change for Html component I have two proposals
import { Html } from '@react-three/drei/Html'
(we can bikeshed later).import { Html } from '@react-three/drei'
will no longer be possible. That way Html won’t be imported when you import anything else but itReactDOM.render
andReactDOM.unmountComponentAtNode
(or the wholeReactDOM
) as props to Html component. That way Html won’t need an internal import and importing react dom will be done by the userlandI like neither of them, but considering won’t hurt I guess
though, having the dependency does not hurt. if you don’t use Html it should never be part of the end bundle even though you have to have it in the dev environment. maybe we should revert the change if it causes that much trouble.