简体   繁体   English

最新 SvelteKit 版本中 SSR 和 Firebase 的问题

[英]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:在我使用 SvelteKit 的最后一个项目中,我使用 firebase 没有任何问题,只需这样做:(我不使用 ts,只使用 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在最新版本中,有些东西发生了变化,我尝试像以前一样进行配置,但我收到警告说配置现在在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.我遇到了类似的问题,我的解决方案是在终端中使用rm -rf node_modules package-lock.json删除旧的节点模块和锁定文件。 Then I reinstalled those files with npm i然后我用npm i重新安装了这些文件

I don't know if this is an ideal solution, but it fixed the problem on my end.我不知道这是否是一个理想的解决方案,但它解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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