expo / expo-electron-adapter

This package wraps `electron-webpack` and adds support for Expo web and other universal React packages.
MIT License
28 stars 11 forks source link

[realm] throws error when running #18

Open younes200 opened 2 years ago

younes200 commented 2 years ago

Hi, I used the template @realm/expo-template-ts with @expo/electron-adapter to run the app with electron runtime, but I'm facing this issue.

Please find reproductible repo here : https://github.com/younes200/expo-electron-realm

Log output

Uncaught TypeError: Cannot read property 'indexOf' of undefined
    at Function.getFileName (webpack-internal:///./node_modules/bindings/bindings.js:178)
    at bindings (webpack-internal:///./node_modules/bindings/bindings.js:82)
    at getRealmConstructor (webpack-internal:///./node_modules/realm/lib/index.js:9)
    at eval (webpack-internal:///./node_modules/realm/lib/index.js:35)
    at Object../node_modules/realm/lib/index.js (renderer.js:5482)
    at __webpack_require__ (renderer.js:791)
    at fn (renderer.js:102)
    at eval (webpack-internal:///./node_modules/@realm/react/dist/index.js:20)
    at Object../node_modules/@realm/react/dist/index.js (renderer.js:1431)
    at __webpack_require__ (renderer.js:791)

Any idea ? Thank you in advance.

younes200 commented 2 years ago

In my app.json I added expo.web.build.babel.include with ["realm","@realm/react"] as documented here https://docs.expo.dev/guides/using-electron/#behavior but no luck :

{
  "expo": {
    "name": "MyAwesomeRealmApp",
    "slug": "MyAwesomeRealmApp",
    "version": "1.0.0",
    "assetBundlePatterns": [
      "**/*"
    ],
    "web": {
      "build": {
        "babel": {
          "include": ["realm", "@realm/react"]
        }
      }
    }
  }
}