LedgerHQ/ledgerjs

Missing babel-runtime dependency in packages

Wollac opened this issue ยท 8 comments

It seems that @ledgerhq/hw-transport-node-hid is requiring babel-runtime, but it is not included as a dependency in that particular package.json.

Steps to reproduce

  • Running the Basic example without babel-runtime, as for example in ledger-btc-test.
  • Manually adding the dependency babel-runtime@6.26.0 to the executing project resolves the issue.

Error

Error: Cannot find module 'babel-runtime/core-js/get-iterator'

Also @ledgerhq/hw-app-str misses babel-runtime dependency.

lib/Str.js:7:

..
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
..

@ledgerhq/hw-app-str, @ledgerhq/hw-transport, @ledgerhq/hw-transport-u2f, @ledgerhq/hw-transport-node-hid all requires babel-runtime and the dependency is missing in each of those packages.

@MisterTicot is right. Could you please move the babel-runtime dependency into the packages? We are blocked by this simple update and want to avoid unnecessary workarounds.

This was probably fixed early November and should be released by now. Could someone check?

Removing the transform-runtime plugin leads to inlined babel-runtime code instead of the require statement.

Looks like all packages need a rebuild. @ledgerhq/hw-transport-node-hid is still on 4.24.0.

This is probably because lerna did not detect a code change.

Fixed in the current release 4.33.3:

$ npm view @ledgerhq/hw-transport-node-hid@4.24.0 dist.tarball
https://registry.npmjs.org/@ledgerhq/hw-transport-node-hid/-/hw-transport-node-hid-4.24.0.tgz
$ npm view @ledgerhq/hw-transport-node-hid dist.tarball
https://registry.npmjs.org/@ledgerhq/hw-transport-node-hid/-/hw-transport-node-hid-4.33.3.tgz

$ wget https://registry.npmjs.org/@ledgerhq/hw-transport-node-hid/-/hw-transport-node-hid-4.24.0.tgz
$ wget https://registry.npmjs.org/@ledgerhq/hw-transport-node-hid/-/hw-transport-node-hid-4.33.3.tgz

$ zgrep --text "babel-runtime/" hw-transport-node-hid-4.24.0.tgz
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _regenerator = require("babel-runtime/regenerator");
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");
var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of");
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
var _createClass2 = require("babel-runtime/helpers/createClass");
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
var _inherits2 = require("babel-runtime/helpers/inherits");
var _promise = require("babel-runtime/core-js/promise");
var _set = require("babel-runtime/core-js/set");
var _toConsumableArray2 = require("babel-runtime/helpers/toConsumableArray");
$ zgrep --text "babel-runtime/" hw-transport-node-hid-4.33.3.tgz

No it's not. Now you need to install regenerator-runtime and to do:

global.regeneratorRuntime = require("regenerator-runtime")

Before loading/using the library.

@MisterTicot could you open a new issue for the regenerator-runtime dependency now that babel-runtime is not a dependency anymore?