How to fix the include invalid directive name error in React & ThreeJS

To use include statements in ReactJS and 3JS, you must use a GLSL enabled ViteJS project.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 11/11/2023 at 11:26
Last Updated on 11/11/2023 at 11:45
<p>Two flowers that represent ReactJS and ThreeJS side by side. Beneath them sits the text "Include Invalid Directive Name."</p>

To use include statements in ReactJS and 3JS, you must use a GLSL enabled ViteJS project.

SubscribeReact, ThreeJS & GLSL Resources
<p>The error that can appear if you try to use an include in a GLSL file within ReactJS and ThreeJS.</p>

To resolve an error similar to the one above, create a ViteJS GLSL enabled project.

How to create a React, Typescript & ThreeJS GLSL Vite ProjectHow to import a GLSL file into a GLSL file in ReactJS & ThreeJS

Looking to learn more about ReactJS and ThreeJS ?

Search our blog to find educational content on learning how to use ReactJS and ThreeJS.

Search our BlogReact, ThreeJS & GLSL Resources

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe