Tuesday, August 14, 2018

pouchdb db.login is not a function

Leave a Comment

Tried using these imports

import PouchDB from 'pouchdb'; import PouchDBAuth from 'pouchdb-authentication';  PouchDB.plugin(PouchDBAuth) 

Module ''pouchdb-authentication'' has no default export is the error generated while using these imports.

PouchDB.plugin(require('pouchdb-authentication')); 

Using require is removing the error but still showing db.login() is not a function.Can anyone suggest where the issue is?

1 Answers

Answers 1

Well I found why it was not working in my situation, I was using this :

import '*' as PouchDBAuthentication from 'pouchdb-authentication'; 

instead of

import PouchDBAuthentication from 'pouchdb-authentication'; 

So the right way is

import PouchDBAuthentication from 'pouchdb-authentication'; import PouchDB from 'pouchdb';  PouchDB.plugin(PouchDBAuthentication); 

In the second hand the following steps should be done : https://github.com/pouchdb-community/pouchdb-authentication/issues/211

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment