realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.69k stars 564 forks source link

Expo Web support #5532

Open riebel opened 1 year ago

riebel commented 1 year ago

Problem

I know the web context of Expo is not officially supported, but since Hermes is now supported and the default engine in Expo SDK 48 also switched to Hermes, maybe it is now somehow possible?

I get it running on Expo48 Android dev client, but when i try to bundle for web, I get:

The package at "node_modules\bindings\bindings.js" attempted to import the Node standard library module "fs".
It failed because the native React runtime does not include the Node standard library.

Maybe there is a workaround or fix for this or is it just plain impossible at the moment?

Solution

No response

Alternatives

No response

How important is this improvement for you?

Dealbreaker

Feature would mainly be used with

Atlas Device Sync

kneth commented 1 year ago

@riebel Thank you for reporting. It is not something we have tried out. You might be able to find a work-around by tweaking your Babel configuration: https://github.com/goatandsheep/react-native-dotenv/issues/78

riebel commented 1 year ago

I tried to modify my babel.config.js with no success:

module.exports = function (api) {
  api.cache(true)
  return {
    presets: ['babel-preset-expo', 'module:metro-react-native-babel-preset'],
    plugins: [
      '@babel/plugin-proposal-export-namespace-from',
      'react-native-reanimated/plugin',
      require.resolve('expo-router/babel')
    ]
  }
}
kneth commented 1 year ago

It is not on our current roadmap to support Expo Web but in general web is an interesting platform. I am curious to learn more about your use case? Do you want to share an app between mobile and web? Are you interested in developing your mobile app as a PWA?

riebel commented 1 year ago

Yes, I share the whole codebase with android, iOs and web and the same app runs flawlessly on all three platforms. I plan to switch from firebase to a self-hosted solution, but I think it is impractical for my project to use different APIs for web and for mobile. It would require a lot of duplicated code and/or a weird wrapper API.

federicogomezlara commented 11 months ago

@riebel Did you find any work around?

riebel commented 11 months ago

@federicogomezlara sadly not.

aronkramer commented 9 months ago

I'm having the same issue.

farynaio commented 1 month ago

same

Arthurmtro commented 1 month ago

+1