Trying to import and use HTML from Drei but keep getting error

Viewed 1252
  import { Html } from '@react-three/drei';
   
 ./node_modules/three-stdlib/lights/RectAreaLightUniformsLib.js
    Attempted import error: 'DataUtils' is not exported from 'three'.

Ive tried looking at the documentation on drei for HTML What I got still doesn't work

The native route of the library does not export Html or Loader. The default export of the library is web which does export Html and Loader.
import { Icosahedron, Html, OrthographicCamera } from '../../src'



import { HtmlProps, CalculatePosition } from 'web/Html'

When I use

import { Html, useProgress, useGLTFLoader } from "drei";

It works

but when I use

  import { Html } from '@react-three/drei';

It breaks

1 Answers

I had a similar issue and solved it with npm install three-stdlib. I found the hint at the top of the README for the drei git repo: https://github.com/pmndrs/drei

A growing collection of useful helpers and abstractions for react-three-fiber.

npm install @react-three/drei

this package is using the stand-alone three-stdlib instead of three/examples/jsm

Related