Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

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

Open
kamescg opened this issue Apr 11, 2018 · 1 comment
Open

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

kamescg opened this issue Apr 11, 2018 · 1 comment

Comments

@kamescg
Copy link

kamescg commented Apr 11, 2018

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
}
@microchipgnu
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants