Skip to content

Realm in a yarn monorepo #7056

@juliencurro-aptar

Description

@juliencurro-aptar

I have a yarn monorepo with multiple packages (react.js, react-native, common), including a mobile app and 2 packages/libraries used by this app.

Those packages defines some Realm data model, when I tried to use them in the mobile app, I get errors about incompatible types between Realm (even if it's the same version).

The types of ‘onMigration’ are incompatible with each other.
Cannot assign type
'import("/Mobile/node_modules/realm/dist/public-types/Configuration").MigrationCallback | undefined'
to type
'import("/node_modules/realm/dist/public-types/Configuration").MigrationCallback | undefined'.

Is there a way in a mobile app to use Realm entities that are coming from another package in a Yarn monorepo context ?
And if so which combination of dependencies/devDependencies/peerDependencies should be used ?

I tried with Realm in peerDependencies only in my library package, tsc fails. With Realm in devDependencies, I get the error above, using the yarn monorepo hoisting I get "Could not find the Realm binary" :(

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions