How to setup a ViteJS project to build to an output directory

Oscar de la Hera Gomez
Two flowers that represent ReactJS and ViteJS side by side. Beneath them sits the text "Setup Build."

A step by step guide on creating a ReactJS, ViteJS, GLSL and ThreeJS project that outputs to a build to the public directory.

The proposed solution can be found on the main branch of our Open Source React, Typescript & ViteJS Starter Project.

git clone git@github.com:delasign/reactjs-3js-vitejs-starter-project.git

Step One: Setup the Project

A screenshot of Chrome showing the shader on a plane and how the shader looks different thanks to the change in colors that we created using the GUI.

Follow the tutorial below to learn how to setup a Typescript & ViteJS project that works with a GLSL shader whose R, G, B color values can be adapted using dat.gui.

Step Two: Update the Vite Config

A screenshot of VSCode showing how we setup the outDir within the vite.config.ts file. This config is setup to output the build to the "public" folder at the root of the project.

In the vite.config.ts file, update the defineConfig to include an outDir that matches the path of where you would like the build to be outputted to.

Step Three: Test

A screenshot of Terminal showing how the build succeeds and outputs to the public folder.

In Terminal, with the current directory set to that of the project, run yarn build and confirm that the build outputs to the right folder.

Looking to learn more about ReactJS, ViteJS and ThreeJS ?

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

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.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details