Search code examples
reactjsbuildreact-three-fiber

Three.JS react-three-fibre vite build failed


i've been working a bit with ThreeJS but can't get it to build.
After some time put into this without any results whatsoever i wanted to ask if any of you know what's wrong.

Project: I made some basic gltf models using blender and want to display/ manipulate them later on. For now they are basically just displayed.

It works on the dev server but tsc returnes multiple errors.

Errors are for example:

  • type declarations not found (despite the needed @types dependencies beeing present)
  • type constraint violations in node_modules

What am i missing?

Disclaimer: I am new to both React and ThreeJS.

Repo Link


Solution

  • Changing "skipLibCheck": true in my tsconfig.json from false to true fixed this issue for me.

    React-three-fiber is most likely built with a less-strict tsconfig which causes this issue to occur.

    Warning: --skipLibCheck degrades type checking, and ideally we wouldn't use it. But not every library provides perfect types yet, so skipping it can be nice.