Skip to content

Common Errors

Scott Vorthmann edited this page May 3, 2023 · 1 revision

Here are some errors that have been seen in projects using solid-three.

Wrong Renderer

Solid-three's render function is not intended for top-level use to render a root, so the normal solid-js/web render function should be used for the root of your application. If you mistakenly import render from solid-three, you'll see an error about "unable to attach", as the solid-three renderer is trying to deal with a DOM node.

TODO: reproduce and provide sample code and the actual error message, and link to more docs.

Missing Compile

Renderer use is actually dictated at compile time by the Babel plugin, which must be configured for generate: "dynamic" with the "dom" renderer falling through to the "universal" renderer. If you forget to update vite.config.ts with this configuration, you'll see an error when the usual solid-js/web DOM renderer tries to attach a mesh, light, or whatever to the <canvas/> DOM element.

TODO: reproduce and provide sample code and the actual error message, and link to more docs.

Multiple Copies of SolidJS

If your development server pulls in two or more copies of SolidJS, due to version dependency problems, you may see strange problems. At least one possible symptom is a "no root for object: ...", resulting from a null return from useContext(ThreeContext). Check your node_modules for any nested node_modules folders, particularly under solid-three.

TODO: reproduce and provide sample code and the actual error message, and link to more docs.