Correct way of importing pouchDB with Angular
- Dominant language
- JavaScript
- Stars
- 17.6k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
### Issue
I am trying to use Angular with pouchDB but i have some trouble importing pouchDB on component.
If i import with:
`
import PouchDB from 'pouchdb';
`
It works but show an error on VsCode:
`
Module '"MYPATH/angular-pouchdb/node_modules/@types/pouchdb/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flagts(1259)
index.d.ts(24, 1): This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.
`
I added the allowSyntheticDefaultImports flag like shown on docs: https://pouchdb.com/guides/setup-pouchdb.html#typescript
If i change the import to:
`
import * as PouchDB from 'pouchdb';
`
I get this error on console and project stops working:
`
pouchdb__WEBPACK_IMPORTED_MODULE_1__ is not a constructor
`
### Info
- Environment: Browser
- Platform: Chrome
- Adapter: indexeddb
### Reproduce
Is possible to reproduce in this repository https://github.com/andreescocard/angular-pouchdb
Contributor guide
Assessment
This issue has not been assessed yet.