添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
奔跑的煎饼果子  ·  Import failed: ...·  1 月前    · 
傲视众生的铁板烧  ·  POSIX Function ...·  2 月前    · 
坚强的铁板烧  ·  Installing the AWS ...·  1 年前    · 

I have an issue with my local development setup that I didn’t have last night but I’m not sure what I have changed that could have caused it.

I also now get an errors in my vite config:

Any help appreciated.

Thanks,
James

Ok the vite config error appears to be fixed by running:
npm install --save-dev @types /node

But not sure what I did to remove this.

As you can see I still get the indexed db error.

Ok so my error comes from me trying to sync my auth store immediately on initialisation

Removing this has got things loading locally again.

Something I only did to try and stop the reload my navbar between page navigation. I will continue to investigate the correct way to fix that.

Good catch :+1:

Server Side Generation (SSG), using the static adapter in SvelteKit, implies that the framework attempts to pre-render your app on a pseudo server-side environment where there is no IndexedDB (IDB). An API which is only available in the browser.

If you have code related to AuthClient, that is executed directly when your app boots, the pre-rendering process will fail because it will try to execute per extension IndexedDB (used by AuthClient) given that the API is not available in the server-side environment, therefore the error ReferenceError: indexedDB is not defined .

To address this issue, if you must execute a piece of code that requires IDB when your app boots in the browser, you can use the browser env flag provided by SvelteKit to ensure that the code is executed only in the browser.

There is no exact location; it depends on your code. This thread was about the AuthClient, so if you encounter the same issue, try to locate that client. Otherwise, try to debug step by step. Also note that browser is not a configuration but a guard you set in your code.

import { browser } from '$app/environment';
if (browser) {
   // do that
} else {
  // do this