简体   繁体   中英

Problems with SSR and Firebase in the latest SvelteKit release

In my last project with SvelteKit, I used firebase without any problems just by doing this: (I don't use ts, only javascript) svelte.config.js:

import adapter from '@sveltejs/adapter-auto'

/** @type {import('@sveltejs/kit').Config} */
const config = {
    kit: {
        vite: {
            server: {
                fs: true
            }
        },
        adapter: adapter()
    }
}

export default config

In the latest version, some things have changed, I tried to configure as I had done before but I got a warning that the configurations are now done in vite.config.js

I tried to do the same thing as before, but it is generating this error:

failed to load module for ssr: ../../../firebase.config
Error: failed to load module for ssr: ../../../firebase.config
    at instantiateModule (file:///C:/Users/rcap/Documents/svelte/bot-imoveis/node_modules/vite/dist/node/chunks/dep-1513d487.js:50250:15)

How can I solve it?

I had a similar problem, and my solution was to remove the old node modules and lock files using rm -rf node_modules package-lock.json in the terminal. Then I reinstalled those files with npm i

I don't know if this is an ideal solution, but it fixed the problem on my end.

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