Edit:
I fixed this by looking through the Godot exported javascript and finding out where the .pck
and .wasm
files were being called (actually ended up being simple, thought it was gonna be deeper than that). I then added /games/gamename/
before the filename being imported. This works for now, though I would like to know how this could be resolved with the _redirects file if anyone has any thoughts
Edit:
To preface this post, I’ve just tried something that narrowed the problem down to the _redirects
file. So I know that’s the issue, just not sure how to resolve it. What I did was remove history mode and leave the _redirects
file, which was my actual suspicion that it was the problem and turns out I was right. It is not working with history mode off but the _redirects
file still there. So maybe there’s some sort of line I can add to make that work. Reading up on it now
Hey guys! I’m having a small issue with a portfolio website that I’m building to show off games that I’ve developed in Godot. I’m having an issue with Vue’s History mode and Netlify redirects that is keeping the games files from loading. I only have 2 routes: /
which showcases all the games, but they’re just videos with a link to play, and /games/:game
which is where you play and read about the game. This route needs to load a GameName.pck
and a GameName.wasm
to work properly. The way I got this to work was by putting these two files in /public/games/GameName/
to match the route. This would avoid me having to dive too deep into the Godot exported code and change the file paths.
So this worked perfectly locally, but when I push my code to Netlify with history mode on and a _redirects
file that looks like this: /* /index.html 200
, I get the loading symbol where the game should be and this error in the console:
CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found ef bb bf 3c @+0
This is the same error I was getting locally when I couldn’t figure out where to place the GameName.pck
and GameName.wasm
files so that they would be loaded in.
The two things I’ve tried so far are
-
npm run build
locally to make sure that it works fine that way and that the static files are being copied appropriately into/dist
. - Turning history mode off, removing the
_redirects
file and pushing my code. Then when I go to/#/games/gamename
on the server, it does work fine. So I know that it has to do either with history mode itself or more likely with my_redirects
file (admittedly I don’t understand 100% how either work).
Any ideas where I need to be placing my files or what to add to the _redirects
file to make this work with history mode on?