apache / apache/pouchdb

pouchdb-replication crashes in React Native Expo SDK 48

Open
#8,638 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
17.6k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

### Issue
After updating my Expo managed app from SDK 47 to SDK 48, replication started to crash. I created new test project containing only new Expo SDK and pouchdb packages. App crashes with following error message:
The package at "node_modules/pouchdb-replication/lib/index.js" attempted to import the Node standard library module "events".
It failed because the native React runtime does not include the Node standard library.
Learn more: https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries

### Info
- Environment: (React Native - Expo SDK 48)
- Platform: (Android)
- Adapter: (react-native-sqlite)
- Server: (N/A)

### Reproduce
Create new Expo project.
Install pouchdb modules:
npx expo install npx expo install pouchdb pouchdb-adapter-http pouchdb-adapter-websql-core pouchdb-core pouchdb-find pouchdb-mapreduce pouchdb-replication react-native-get-random-values react-native-uuid

Create module where you import all plugins:
"use strict";

import PouchDB from "pouchdb-core";
import find from "pouchdb-find";
import HttpPouch from "pouchdb-adapter-http";
import replication from "pouchdb-replication";
import mapreduce from "pouchdb-mapreduce";

export default PouchDB.plugin(HttpPouch)
.plugin(replication)
.plugin(find)
.plugin(mapreduce);

Import this modul into App.js

Application crashes with error:
The package at "node_modules/pouchdb-replication/lib/index.js" attempted to import the Node standard library module "events".
It failed because the native React runtime does not include the Node standard library.
Learn more: https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.