-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript + Angular (webpack) #52
Comments
I'm pretty sure "PouchDB.adapter is not a function" is a TypeScript compilation error caused by the @types/pouchdb definitions for PouchDB, which don't appear to include a definition for "adapter". The correct long-term fix is to update @types/pouchdb and add the adapter definition. In the meantime, as a crude short-term band-aid fix, you can temporarily bypass type checking, like so: import PouchDB from 'pouchdb-browser';
import WorkerPouch from 'worker-pouch';
(<any>PouchDB).adapter('worker', WorkerPouch); or, for other people who have "allowSyntheticDefaultImports" = false: import * as PouchDB from 'pouchdb-browser';
import * as WorkerPouch from 'worker-pouch';
(<any>PouchDB).adapter('worker', WorkerPouch); |
I'm not sure it uses the workers but here's the code that I managed to make it run without errors: I would recommend adding all this info above to the readme.md file to help other developers using this package easily :-) Thanks for the quick response! |
Ok, I think I managed to make it work without the |
I now see that issue #50 describes the error I'm seeing. |
I have an issue with pouch db that causes the UI thread to be sluggish when using
put()
.I was hoping to use this plugin to fix this.
I had issues make PouchDB work and I hope this isn't the root cause.
tsconfig.json
add"allowSyntheticDefaultImports": true
import PouchDB from "pouchdb"
;let db = new PouchDB("db");
So far the original setup which works on the UI thread.
Now when doing the following
I'm getting an error:
Invalid Adapter: worker
When using:
I'm getting an error:
PouchDB.adapter is not a function
I've also tried with
PouchDB.plugin(require('worker-pouch'))
but it didn't work too, something with immutable...Help would be appreciated, I'm probably missing a simple thing...
The text was updated successfully, but these errors were encountered: