I’m trying to deploy a sveltekit app to firebase (bigginner with sveltekit). I assumed we’re going to build the app and get our index.html file but that is not the case with sveltkit.
I’m using svelte auto adapter( Required in my case)
"svelte": "^3.46.0"
Now I tried updating the firebase config file to be like this
{
"hosting": {
"public": "src",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
},
"rewrites": [
{
"source": "**",
"destination": "/src/app.html"
}
]
}
Also as per the priority of hosting order in firebase documentation
I deleted index.html file populated by firebase, yet still not working and I’m getting page not found error with This file does not exist and there was no index.html found in the current directory.
Any idea what am I missing?
2
Answers
For anyone looking for the answer, after a long searching day, I concluded this.
As per the documentation firebase is not one of the supported environments. So I had to adapt my app to using a static adapter and updated:
svelte config like this:
firebase config
and in layouts
That's all, just build and deploy.
There is a npm package for this as advertised on the landing page at kit.svelte.dev
svelte-adapter-firebase
https://github.com/jthegedus/svelte-adapter-firebase
Follow the instructions in the readme. This package is in flux so there maybe some hacky fixes you need to do at the time of this post. Hopefully it will be fixed to align with SvleteKit 1.0 soon