Skip to content

Commit 2423725

Browse files
authored
Merge pull request #202 from blocknative/test/rollup-build
Merge in build changes to work with Rollup.js builds
2 parents 0d15b83 + d2743b3 commit 2423725

File tree

4 files changed

+21
-30
lines changed

4 files changed

+21
-30
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"babel-plugin-external-helpers": "^6.18.0",
3232
"rimraf": "^3.0.0",
3333
"rollup": "^1.27.5",
34-
"rollup-plugin-commonjs": "^10.0.0",
3534
"rollup-plugin-img": "^1.1.0",
3635
"rollup-plugin-node-globals": "^1.4.0",
3736
"rollup-plugin-node-resolve": "^5.2.0",

rollup.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import svelte from 'rollup-plugin-svelte'
22
import resolve from 'rollup-plugin-node-resolve'
33
import json from '@rollup/plugin-json'
44
import image from 'rollup-plugin-img'
5-
import commonjs from 'rollup-plugin-commonjs'
65
import typescript from 'rollup-plugin-typescript2'
76

87
import {
@@ -25,7 +24,7 @@ export default {
2524
input: 'src/onboard.ts',
2625
output: [
2726
{
28-
format: 'es',
27+
format: 'esm',
2928
dir: 'dist/esm/'
3029
},
3130
{ format: 'cjs', dir: 'dist/cjs/' }
@@ -42,7 +41,6 @@ export default {
4241
importee === 'svelte' || importee.startsWith('svelte/'),
4342
preferBuiltins: true
4443
}),
45-
commonjs(),
4644
typescript({
4745
clean: true,
4846
useTsconfigDeclarationDir: true
@@ -68,6 +66,8 @@ export default {
6866
'util',
6967
'assert',
7068
'buffer',
71-
'stream'
69+
'stream',
70+
'web3-provider-engine/subproviders/hooked-wallet',
71+
'web3-provider-engine/subproviders/rpc'
7272
]
7373
}

src/modules/select/wallets/ledger.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ import {
66
} from '../../../interfaces'
77
import ledgerIcon from '../wallet-icons/icon-ledger'
88

9+
import Web3ProviderEngine from 'web3-provider-engine'
10+
import RpcSource from 'web3-provider-engine/subproviders/rpc'
11+
import HookedWalletSubprovider from 'web3-provider-engine/subproviders/hooked-wallet'
12+
import TransportU2F from '@ledgerhq/hw-transport-u2f'
13+
import Eth from '@ledgerhq/hw-app-eth'
14+
import { Transaction } from 'ethereumjs-tx'
15+
16+
const EthereumTx = Transaction
17+
918
function ledger(options: LedgerOptions & CommonWalletOptions): WalletModule {
1019
const { rpcUrl, networkId, preferred, label, iconSrc, svg } = options
1120

@@ -64,19 +73,6 @@ async function ledgerProvider(options: {
6473
BigNumber: any
6574
networkName: (id: number) => string
6675
}) {
67-
const Web3ProviderEngine = (await import('web3-provider-engine')).default
68-
const RpcSource = (await import('web3-provider-engine/subproviders/rpc'))
69-
.default
70-
71-
const HookedWalletSubprovider = (
72-
await import('web3-provider-engine/subproviders/hooked-wallet')
73-
).default
74-
75-
const TransportU2F = (await import('@ledgerhq/hw-transport-u2f')).default
76-
const Eth = (await import('@ledgerhq/hw-app-eth')).default
77-
78-
const EthereumTx = (await import('ethereumjs-tx')).Transaction
79-
8076
const { networkId, rpcUrl, BigNumber, networkName } = options
8177
const basePath = networkIdToDerivationPath(networkId)
8278

src/modules/select/wallets/trezor.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ import {
66
} from '../../../interfaces'
77
import trezorIcon from '../wallet-icons/icon-trezor'
88

9+
import Web3ProviderEngine from 'web3-provider-engine'
10+
import RpcSource from 'web3-provider-engine/subproviders/rpc'
11+
import HookedWalletSubprovider from 'web3-provider-engine/subproviders/hooked-wallet'
12+
import * as TrezorConnectLibrary from 'trezor-connect'
13+
import EthereumTx from 'ethereumjs-tx'
14+
15+
const { default: TrezorConnect, DEVICE_EVENT, DEVICE } = TrezorConnectLibrary
16+
917
function trezor(options: TrezorOptions & CommonWalletOptions): WalletModule {
1018
const {
1119
rpcUrl,
@@ -77,18 +85,6 @@ async function trezorProvider(options: {
7785
BigNumber: any
7886
networkName: (id: number) => string
7987
}) {
80-
const Web3ProviderEngine = (await import('web3-provider-engine')).default
81-
const RpcSource = (await import('web3-provider-engine/subproviders/rpc'))
82-
.default
83-
84-
const HookedWalletSubprovider = (
85-
await import('web3-provider-engine/subproviders/hooked-wallet')
86-
).default
87-
88-
const TrezorConnectLibrary = await import('trezor-connect')
89-
const { default: TrezorConnect, DEVICE_EVENT, DEVICE } = TrezorConnectLibrary
90-
const EthereumTx = (await import('ethereumjs-tx')).Transaction
91-
9288
const { networkId, email, appUrl, rpcUrl, BigNumber, networkName } = options
9389
const basePath = networkIdToDerivationPath(networkId)
9490

0 commit comments

Comments
 (0)