store.pouchdb icon indicating copy to clipboard operation
store.pouchdb copied to clipboard

Using with Ionic 2 RC3

Open heikoholland opened this issue 9 years ago • 1 comments

Can you help me getting this plugin to work with Ionic2 RC3?

I used this repo for testing: https://github.com/nolanlawson/pouchdb-ionic-2-typescript-demo

After cloning I added your plugin with npm install store.pouchdb --save to the project and edit the src/app/app.compnent.ts to something like this:

import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';

import { TabsPage } from '../pages/tabs/tabs';

import PouchDB from 'pouchdb';
import * as PouchDBStore from 'store.pouchdb';


@Component({
  template: `<ion-nav [root]="rootPage"></ion-nav>`
})
export class MyApp {
  rootPage = TabsPage;

  constructor(platform: Platform) {
    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();
      Splashscreen.hide();

      console.log(PouchDB);
      console.log(PouchDBStore);
    });
  }
}

But I can't get it to work. I get the following error:

Uncaught TypeError: Cannot read property 'prototype' of undefined
    at Object.inherits (http://localhost:8100/build/main.js:82666:45)
    at http://localhost:8100/build/main.js:117055:9
    at createCommonjsModule (http://localhost:8100/build/main.js:6360:35)
    at http://localhost:8100/build/main.js:116896:15
    at http://localhost:8100/build/main.js:140164:2

heikoholland avatar Nov 21 '16 15:11 heikoholland

So after some days of researching and trying to fix this I got some more information.

After I installed the latest version of the ionic build scripts (npm install --save-dev @ionic/[email protected]) the error messages changed.

Uncaught TypeError: Cannot set property '_name' of undefined                          store.js:26

this is undefined in this function and I don't know why. I'm not familiar enough with webpack so I don't know why this function is even called at this time because it's called before the app is loaded.

heikoholland avatar Nov 30 '16 16:11 heikoholland