pouchdb-community / pouchdb-all-dbs

allDbs() plugin for PouchDB
Apache License 2.0
29 stars 17 forks source link

fix(pouch-utils): Fix pouchdb-promise's ES6 import with _interopDefault #35

Closed bravier closed 3 years ago

bravier commented 3 years ago

Recent PR #34 upgraded pouchdb-promise package version from 5.4.3 to 6.4.3.

This new version is shipped with two module flavors: the old fashioned CommonJS module syntax (lib/index.js) and the new ES6 module syntax (lib/index.es.js).

If you build using ES Module then you'll get an error at runtime: Promise is not a constructor because when pouch-utils.js requires pouchdb-promise it expects Promise is assigned the value of the default export. It's not the case with ES6 module as it's in the default property.

Similar to pouchdb-community/worker-pouch#40, this PR adds the _interopDefault function so both cases work fine.

openscript commented 3 years ago

Good catch! Thank you very much for the PR.

bravier commented 3 years ago

Thanks for the fast approval / release / publication @openscript! :zap: