How do I set up PouchDB with Sapper?

Viewed 207

I have a project built with Sapper, and I'm using Rollup as the bundler. I've been trying to set up PouchDB to work with my app, but with pouchdb-browser, pouchdb-find, and relational-pouch installed as dev dependencies, the build always crashes with a fetch is not defined error.

I'm sure this is because I am not familiar enough with how Rollup and Sapper works. From my understanding, it's because Sapper is performing SSR, and in the server's context, fetch is not defined. If this is indeed the case, how do I configure Rollup/Sapper to resolve this build error?

Thanks!

0 Answers
Related