decentraland / decentraland-eth

DEPRECATED - Ethereum common helpers for Decentraland
https://decentraland.github.io/decentraland-eth/
Apache License 2.0
15 stars 9 forks source link

feat: add es5 target #6

Closed menduz closed 6 years ago

menduz commented 6 years ago

... to support create-react-app

nicosantangelo commented 6 years ago

We're running into a problem with web3-provider-engine in two places. They are using two builds the same way we're doing here, so to make the import work, we sould first update the web3-provider-engine dependency to ^14 and then change the following:

diff --git a/src/ethereum/wallets/LedgerWallet.ts b/src/ethereum/wallets/LedgerWallet.ts
- import ProviderEngine from 'web3-provider-engine'
- import RpcSubprovider from 'web3-provider-engine/subproviders/rpc'
+ import ProviderEngine from 'web3-provider-engine/dist/es5'
+ import RpcSubprovider from 'web3-provider-engine/dist/es5/subproviders/rpc'

After fixing that, we encounter the same error on ledger-wallet-provider, where they're importing hooked-wallet from the non-es5 version. I'm not sure there's much of a choice here other than using this fork which contains this commit.

diff --git a/package.json b/package.json
- "ledger-wallet-provider": "^2.0.0-beta.2",
+ "ledger-wallet-provider": "https://github.com/decentraland/ledger-wallet-provider.git#releases"

Any other ideas?

nicosantangelo commented 6 years ago

Fixed by using this hack https://github.com/facebook/create-react-app/issues/1125#issuecomment-348650919

Will wait until create-react-app updates to transpile node_modules