简体   繁体   中英

Firebase Hosting not running Sveltekit

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?

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM