Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

broken build for modern web dev build process configuration (vite, vue.js)

A topic by okwme created May 01, 2025 Views: 101
Viewing posts 1 to 1

I was trying to figure out why my webapp game built with p5 but nested within a vue.js application wasn't rendering after I uploaded a zip of the build. I found this old question on the topic: https://itch.io/t/851154/html-js-react-game-returns-403-errors but it didn't have a good solution. I wanted to share my solution in case anyone else was running into a similar problem.

Basically there are two places I had to make changes. The first was in the vite.config.js where there is an option for a `base`. Previously there was nothing there and the default option is `'/'` but this doesn't work since itch serves the file from a relative path so you need to change the base to a relative path like `'/'` or to be more complete like this `return defineConfig({base: './'})`.

The other issue was in my router. I'm using vue but I'm sure there's a similar configuration change relevant to react's router system. Basically if you have the ability to add a proxy redirect to your server, you'll set all paths to direct to the home and that way you'll keep a pretty URL like `mywebsite.com/some-route` instead of `mywebsite.com#some-route`. But if you can't configure the redirect (like on itch) you have to use these hash tag routes. In vue.js router it changes from `const router = createRouter({ history: createWebHistory() })` to  `const router = createRouter({ history: createWebHashHistory() })`.

With both of these changes the site serves correctly : )

This topic has been auto-archived and can no longer be posted in because there haven't been any posts in a while.