I'm trying to import PouchDB into my Angular application. I've tested differents import methods :
import PouchDB from 'pouchdb';
import * as PouchDB from 'pouchdb';
I am using it like below into a service :
database: PouchDB.Database = new PouchDB(DATABASE_URL);
If I do : import PouchDB from 'pouchdb'
, I get the following error message :
src/app/core/pouchdb/pouchdb.service.ts(3,8): error TS1192: Module '"{PATH_OF_PROJECT}/node_modules/@types/pouchdb/index"' has no default export.
If I do : import * as PouchDB from 'pouchdb'
, I get the following error message :
ERROR TypeError: PouchDB is not a constructor at new PouchDBService
Here are the versions of the different packages :
- PouchDB : 6.4.3
- @types/pouchdb : 6.3.2
- Angular packages : 5.2.0
- @angular/cli : 1.7.4
Thank you in advance for your answers.
node_modules
folder and runnpm install
again