LtbLightning / bdk-rn

Bitcoin Development Kit - React Native Module
MIT License
50 stars 15 forks source link

Running on Expo #38

Closed loic86 closed 1 year ago

loic86 commented 1 year ago

Hi, I'm new to both react native and BDK, so I'm sorry for the silly question. I'm now running React Native with Expo: npx expo start and I get the error:

ERROR in ./node_modules/bdk-rn/src/index.ts 18:9 Module parse failed: Unexpected token (18:9) File was processed with these loaders:

  • ./node_modules/source-map-loader/dist/cjs.js You may need an additional loader to handle the result of these loaders. class BdkInterface { public _bdk: any;
    constructor() {

I tried to fix by adding: pm i -D @expo/webpack-config but it looks like I have to add a line in babel.config.js I tried adding bdk-nm but didn't manage to run it yet. (similar issue here) Is there a way to run bdk-rn with expo or is not possible? Thank you in advance for your time.

BitcoinZavior commented 1 year ago

@loic86 Thanks for taking a look. This will work with expo, I am aware of a couple of users who are using this with expo. If you are still facing an issue I will try and replicate your issue, I suspect it's probably to do with the RN env or something similar.

loic86 commented 1 year ago

Ok, thanks for the feedback! I will go through RN deeper and figure it out and let you know asap.

BitcoinZavior commented 1 year ago

Hi @loic86

There are 2 different workflows used by Expo to run Apps.

  1. Managed workflow: Uses services/modules provided by Expo e.g npx expo start
  2. Bare workflow: Uses 3rd party libraries as well, “bdk-rn” is considered 3rd party for expo. e.g npx expo run:ios

I was able to run in a expo project using npx expo run:ios

loic86 commented 1 year ago

Thank you! Indeed, I was using the former workflow, the latter works fine. Thanks!