pouchdb db.login不是一个函数

sha*_*ini 13 couchdb pouchdb

尝试使用这些进口

import PouchDB from 'pouchdb';
import PouchDBAuth from 'pouchdb-authentication';

PouchDB.plugin(PouchDBAuth)
Run Code Online (Sandbox Code Playgroud)

模块''pouchdb-authentication''没有默认导出是使用这些导入时产生的错误.

PouchDB.plugin(require('pouchdb-authentication'));
Run Code Online (Sandbox Code Playgroud)

使用require删除错误,但仍然显示db.login()不是一个函数.任何人都可以建议问题出在哪里?

Noe*_*out 3

好吧,我发现为什么它在我的情况下不起作用,我正在使用这个:

import '*' as PouchDBAuthentication from 'pouchdb-authentication';
Run Code Online (Sandbox Code Playgroud)

代替

import PouchDBAuthentication from 'pouchdb-authentication';
Run Code Online (Sandbox Code Playgroud)

所以正确的方法是

import PouchDBAuthentication from 'pouchdb-authentication';
import PouchDB from 'pouchdb';

PouchDB.plugin(PouchDBAuthentication);
Run Code Online (Sandbox Code Playgroud)

另一方面,应完成以下步骤: https: //github.com/pouchdb-community/pouchdb-authentication/issues/211