PouchDbFind-Not defined in RC2


#1

Hello all,
Just upgraded to RC2 and install all the necessary packages. I went to build and serve my project and am getting back this console error:

ReferenceError: pouchdbFind is not defined

I installed pouchdb, pouchdb-find and the cordova plugin for pouchdb. Still this error persists.

This is how i define it in my service:

import * as PouchDB from ‘pouchdb’;

declare var pouchdbFind: any;
declare var PouchAdapterCordovaSqlite: any;

export class StorageService(){
PouchDB.plugin(pouchdbFind);
PouchDB.plugin(PouchAdapterCordovaSqlite);
…Do stuff
}

Even if I import import * as pouchdbFind from 'pouchdb-find'; explicitly, I get a typings error. The node-module is installed, but the problem still persists. Im afraid I will have to downgrade to RC1 until I can fix this issue.

Thanks!


#2

try:

import PouchDB from 'pouchdb';
import PouchDBFind from 'pouchdb-find';

with RC2 you should have a declarations.d.ts file in src with declare module '*'; inside it to stop typings errors


Use angular 2 module in ionic 2 => Error: Cannot find module
#3

Thanks! For anyone with similar problems, you have to import PouchAdapterCordovaSqlite from 'pouchdb-adapter-cordova-sqlite'; as well. Then

PouchDB.plugin(PouchDBFind);
PouchDB.plugin(PouchAdapterCordovaSqlite);