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?
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:
const config = {
kit: {
adapter: adapter({
pages:"build",
assets:"build",
fallback: "index.html",
precompress: true,
strict:true
})
}
};
firebase config
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
"rewrites": [
{
"source": "**",
"destination": "/app.html"
}
]
}
and in layouts
export const ssr = false;
That's all, just build and deploy.