mnid icon indicating copy to clipboard operation
mnid copied to clipboard

[BUG] MNID object is undefined using ES6/Webpack import

Open kamescg opened this issue 7 years ago • 1 comments

When the mnid object imported from the dependency I get undefined.

import mnid, {decode} from 'mnid'
console.log(mnid)
console.log(decode)

*console output*

undefined
ƒ decode(encoded) {
  var data = _buffer.Buffer.from(base58.decode(encoded));
  var netLength = data.length - 24;
  var version = data.slice(0, 1);
  var network = data.slice(1, netLength);
  var addre…

I presume this is just a Webpack/ES6 import bug for bundling (personally I don't feel digging in)? To be safe would it make sense to add export default object exporting the functions?

export default {
 checksum,
 encode,
 decode,
 isMNID
}

kamescg avatar Apr 11 '18 18:04 kamescg

I've tried to use mnid.decode and it logs undefined too. I tried to add export default, but it didn't solve the problem. I used Truffle uPort boilerplate.

microchipgnu avatar Jul 05 '18 10:07 microchipgnu