Open kraenhansen opened 2 months ago
➤ PM Bot commented:
Jira ticket: RJS-2765
Adding the same notes as in the corresponding PR description regarding being blocked:
The BSON package is currently using top-level await which currently prevents us from bundling if don't enable that feature. @kraenhansen has contributed a PR to BSON to alleviate this for us (see Jira ticket).
@elle-j and I looked further into this last week and realized:
bson@6
is relying soly on exports conditions to expose its React Native bundle: https://github.com/mongodb/js-bson/blob/c58d1e213714c99bbb09d0f91a3c9199e43710dd/package.json#L90. This problematic, because Metro is currently considering its ability to resolve using exports conditions "experimental" and its disabled by default.base64
dependency is required by the React Native bundle, confuses Metro. We need to investigate this further, but our current suspicion is the use of a "sub-package" / "bundled dependency", in the sense that the vendored "base64" is resolved via a "package.json" which is included in a sub-directory of the "bson" package.
The public types emitted for
bson.d.ts
are wrong:This is really weird since we're importing the right type from the namespace:
https://github.com/realm/realm-js/blob/1e1e48a0f906d471b4a046168ed8cd628ef2d70f/packages/realm/src/bson.ts#L27-L30
We should be able to upgrade to
bson@6
by now and this will fix the issue since that has removedObjectID
(capital D) entirely.