Home > other >  Firebase Hosting not running Sveltekit
Firebase Hosting not running Sveltekit

Time:09-04

I've created an app using Sveltekit and I want to host it statically on Firebase.

My svelte.config.js file is as follows:

import adapter from '@sveltejs/adapter-static';
import preprocess from 'svelte-preprocess';

/** @type {import('@sveltejs/kit').Config} */
const config = {
    kit: {
        adapter: adapter({
            pages: 'public',
            assets: 'public',
            fallback: 'index.html',
            precompress: false
        }),
        prerender: {
            default: true
        }
    },
    preprocess: [
        preprocess({
            postcss: true
        })
    ]
};

export default config;

My firebase.json is like this:

{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [ {
      "source": "**",
      "destination": "/index.html"
    } ]
  }
}

When I visit the site using the firebase provided URL, only the HTML is rendered in my browsers, and no CSS or Javascript is executed. I see that all of the files are served to my browser, they just do not run. I have no issues in development and when previewing, only when deploying. Any idea on what I could be doing wrong?

CodePudding user response:

have you tried this? https://www.npmjs.com/package/svelte-adapter-firebase

I did not search for but maybe there is a "static" configuration.

CodePudding user response:

Closing this question for now. Seems to have been a bug with the version of Sveltekit I was using.

  • Related