I am failing to deploy a simple website using Github Pages and the three.js library. There is successful functionality running the local repository in its' base state.
Once attempting to deploy via Github Pages, I am thrown a 404 error after following what I found to be the most common workflow -
- create a /dist folder,
- place the necessary files in it, (index.html, styles.css, main.js, assets, etc.)
- deploy within a secondary branch 'gh-pages'.
I have redirected .js and .css references in the index to regard this change, though I am still receiving a 404 error.
The website was created using vite.js
What are some steps I could take to help aid this problem? I have rebuilt from scratch and used several references but cannot seem to solve this issue.
*Edit: I have configured the repository successfully with Github Pages and it is indicated as live.
I found that using gh-pages is the easiest way. Here are the steps I take:
npm install gh-pages"deploy": gh-pages -d distnpm run build) & make sure you have a GitHub repo.npm run deployin the terminal, which will set up your project in Git Hub Pages.Running
npm run deployautomatically creates a branch called gh-pages. It also automatically sets up your GitHub Pages settings to reference this branch.Here is a Loom video of me successfully deploying a new Three.js/Vite project to GitHub pages. I go through each of the steps I listed above. You may also reference my repo here.
Hope this helps!