Closed faustbrian closed 2 years ago
ts-node, jest, and a loooooot of tooling is not supporting ESM yet... perhaps going pure ESM was a mistake...
I have successfully made a hybrid project with https://github.com/bitcoinjs/uint8array-tools
Perhaps I can do something similar with this project.
Guess the solution for now is to stay on v1 of tiny-secp256k1 if we don't want to run this issue. Doesn't seem to cause any issues for the bip32 package but still missing out on the bug fixes in v2 of tiny-secp256k1.
Fixed in v2.1.1
Both require and import can be used, and webpack etc. will use ESM for the browser.
Upgrading to
3.0.0
of https://github.com/bitcoinjs/bip32 in a project that uses ESM is causing some issues when using the suggestedtiny-secp256k1
. When running tests vianode --experimental-vm-modules node_modules/jest/bin/jest.js --forceExit "source/public-key.service.test.ts"
an error aboutMust use import to load ES Module
is thrown.This seems to be caused by
tiny-secp256k1
having declared itstype
asmodule
inpackage.json
since2.0.0
which means you can no longerrequire
it with certain tooling because they'll throw exceptions if you try torequire
anything that is declared as a module.Is the suggested solution to stay on
1.0.0
oftiny-secp256k1
if you don't want to encounter this error? I saw there have been various bug fixes on2.0.0
so it seems like an upgrade would be sensible.