Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I use Nuxt framework, using SSR rendering will appear UnhandledPromiseRejectionWarning: MissingAPIError: no t found with indexedDB API. #804

Open
qq781548819 opened this issue Feb 27, 2019 · 2 comments

Comments

@qq781548819
Copy link

qq781548819 commented Feb 27, 2019

in nuxt.config.js file



 /*
   ** Plugins to load before mounting the App
   */
  plugins: [
     '@/plugins/vuetify',
    {src:"@/plugins/db/index",ssr:false},
     // {
     //   src: '~plugins/vue-infinite-loading',
     //   ssr: false
     // },
      '~/plugins/axios',
     {
       src: '~plugins/ga.js',
       ssr: false
     },
     '~/plugins/core.js'
   ],

in /db/index.js

import Novel from './novel'
import Source from './source'
import Chapter from './chapter'
import Content from './content'
const db = new Dexie("toyue");
db.version(1).stores({
  novels: "&novel,*author,cover,intro,status,major,last_time",
  sources: "&novel,*author,last_chapter,last_url,total,last_update,detail_url,&parse_url,prefix_url,domain,current_index", //当前观看的下标
  chapters: "&parse_url,*catalogue",
  contents: "&parse_url,content_url,content",
  origins: "&novel,*sources"
});
db.novels.mapToClass(Novel);
db.sources.mapToClass(Source);
db.chapters.mapToClass(Chapter);
db.contents.mapToClass(Content);

export default db
@dfahlander
Copy link
Collaborator

Dexie is dependant on the IndexedDB interface that is a W3C browser interface. IndexedDBShim could possibly be used on nodejs to emulate the same interface on node, using sqlite3 as storage. Not sure the status of that setup right now. Maybe more info here: indexeddbshim/IndexedDBShim#325.

@Rednas83
Copy link

Rednas83 commented Oct 3, 2021

Perhaps not ideal but for nuxt/next/ssr a workaround/solution could be

  • lazy load your client component const form = () => import('...')
  • wrap your client code inside an if(process.client) statement

See also this blog https://deltener.com/blog/common-problems-with-the-nuxt-client-only-component/ for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants