Closed vano21 closed 6 years ago
I did not test the esm bundle, but the cjs and umd ones are working well. Can you provide a full reproduction script (with the imports)?
Also, what’s your module bundler? Webpack?
And, do you have the problem only with work
?
These work: generateSeed() and deriveSecretKey()
These do not work: derivePublicKey(), deriveAddress() and work()
they produce a similar error (checkKey is not a function)
Looks like it has something to do with exporting from nano currency.esm.js - the problematic ones seem to be the ones being exported as an alias of checkSeed.
I am using a standard create-react-app generated project, this is basically the only imports:
import React from 'react';
import * as nanoCurrency from 'nanocurrency';
Ok I just did this:
import * as nanoCurrency from '../node_modules/nanocurrency/dist/nanocurrency.cjs';
and it all works now.
The problem is with the esm one.
There must be a problem in either the Rollup bundling or the Babel transpiling. I implemented a workaround, not exporting aliases but actual wrapper functions. It feels cleaner anyway, so I am comfortable with that.
Can you test with 1.7.4?
All ok now!
hashSendBlock, hashReceiveBlock and signBlock also all work.
Perfect! Thanks. 😉
I can't get work() to do its thing:
const pow = nanoCurrency.work(accountHash);
Outputs:
nanocurrency.esm.js:6 Uncaught (in promise) TypeError: checkHash is not a function at Object.work (http://localhost:3000/static/js/bundle.js:25491:182215)
This is in a react app.