BlinkTradeJS icon indicating copy to clipboard operation
BlinkTradeJS copied to clipboard

Not working with create-react-app

Open doijunior opened this issue 8 years ago • 2 comments

I am trying to use the sdk in a pwa app created with create-react-app, but I'm getting those errors after yarn add blinktrade

The version installed of the sdk is 0.0.7

Error in ./~/blinktrade/lib/util/stun.js
Module not found: 'dgram' in /media/dados/workspace/pwa-experiment/node_modules/blinktrade/lib/util

 @ ./~/blinktrade/lib/util/stun.js 37:13-29

Error in ./~/macaddress/lib/windows.js
Module not found: 'child_process' in /media/dados/workspace/pwa-experiment/node_modules/macaddress/lib

 @ ./~/macaddress/lib/windows.js 1:11-35

Error in ./~/macaddress/lib/linux.js
Module not found: 'child_process' in /media/dados/workspace/pwa-experiment/node_modules/macaddress/lib

 @ ./~/macaddress/lib/linux.js 1:11-35

Error in ./~/macaddress/lib/unix.js
Module not found: 'child_process' in /media/dados/workspace/pwa-experiment/node_modules/macaddress/lib

 @ ./~/macaddress/lib/unix.js 1:11-35

doijunior avatar Jun 21 '17 14:06 doijunior

Hi Gilson, it works fine with create-react-app, you just need to import the browser endpoint as follows import blinktrade from 'blinktrade/browser'.

Let me know if you got it.

cesardeazevedo avatar Jun 23 '17 07:06 cesardeazevedo

Cesar I tried this but I got blinktrade undefined I didn't mentioned before that I am trying to use the SDK to get FoxBit ticker and show on my app. So I want to do something like:

BlinkTrade.ticker().then(function(ticker) {
   tickerStore.high = ticker.high;
   ...
}

doijunior avatar Jun 23 '17 13:06 doijunior