urbit / urbit-key-generation

Key derivation and HD wallet generation functions for Urbit
MIT License
15 stars 8 forks source link

TypeError: Cannot read property 'utils' of undefined #3

Closed g-a-v-i-n closed 5 years ago

g-a-v-i-n commented 5 years ago

Branch: tests

Encountered when running against tests against dist/bundle.js This also appears in the wallet-generator frontend.

I think this has something to do with the BIP32 library, or how this specific part is bundled.

TypeError: Cannot read property 'utils' of undefined

      14015 | 
      14016 | 
    > 14017 | var utils$1 = elliptic_1.utils;
            |                          ^
      14018 | var getNAF = utils$1.getNAF;
      14019 | var getJSF = utils$1.getJSF;
      14020 | var assert$2 = utils$1.assert;

      at Object.utils (dist/index.js:14017:26)
      at Object.<anonymous> (tests/test.js:1:1)
g-a-v-i-n commented 5 years ago

@joemfb do you have time to take a look at this? Seems to be the final issue blocking this lib from being bundled.

joemfb commented 5 years ago

I'm happy to, but I'm not clear on the bundling requirements for this lib. Won't any downstream applications have to include their own bundling regardless of what's done here?

g-a-v-i-n commented 5 years ago

keygen-js should just be an common js module. The bundling step completes, but using the lib or running tests against the build returns this error. I'm fairly confident that this is some issue with the rollup config, but not 100% sure.

g-a-v-i-n commented 5 years ago

@joemfb you seriously rock dude. Thanks for the help! Closing.

seansean11 commented 5 years ago

Was this resolved? I'm running into the same issue when using this package with rollup.

jtobin commented 5 years ago

@seansean11 IIRC you can try the rollup-plugin-node-resolve plugin and specify the following in your rollup.config.js or similar:

plugins: [
  ..,
  resolve({
    browser: true,
  }),
  ..
]