Skip to content

Commit

Permalink
Fix for HID on ES2015; does not support dymanic imports (#798).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Apr 25, 2020
1 parent d1f3a42 commit 5aefb43
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/hardware-wallets/src.ts/ledger-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@ const hidWrapper = Object.freeze({
create: function(): Promise<Transport> {
// Load the library if not loaded
if (hidCache == null) {
hidCache = new Promise((resolve, reject) => {
try {
let hid = require("@ledgerhq/hw-transport-node-hid");
if (hid.create == null) { resolve(hid["default"]); }
resolve(hid);
} catch (error) {
reject(error);
}
});
/*
hidCache = import("@ledgerhq/hw-transport-node-hid").then((hid) => {
if (hid.create == null) { return hid["default"]; }
return hid;
});
*/
}

return hidCache.then((hid) => {
Expand Down

0 comments on commit 5aefb43

Please sign in to comment.