bitcoinjs / bip39

JavaScript implementation of Bitcoin BIP39: Mnemonic code for generating deterministic keys
ISC License
1.11k stars 447 forks source link

ESM module support #169

Open JonasWijne opened 3 years ago

JonasWijne commented 3 years ago

main.ts

import { wordlists } from 'bip39';

console.log(wordlists['EN']);

i get multiple issues, since thisa is cjs, could this be made to work with esm

junderw commented 3 years ago

Pull requests are welcome.

I have successfully created some hybrid packages like uint8array-tools.

JonasWijne commented 3 years ago

made a repo where i reproduced the issue (https://github.com/jimbertools/vite-bip39), i looked at the problem for 2 days :rofl:

junderw commented 3 years ago

Memo for possible solutions:

JonasWijne commented 3 years ago

we made a simple ts lib with only what we needed, in the future we will make this feature parity with this lib and make a pull request or something

https://github.com/jimbertools/simple-bip39

junderw commented 2 years ago

I have a fork for this: https://github.com/nahoc10/bip39-esm-support

Pull requests welcome, but it seems like your fork completely breaks everything with no attempt to try and maintain compatibility via a hybrid model etc.

Also, you are violating the terms of the ISC license:

provided that the above copyright notice and this permission notice appear in all copies.

You have completely removed the Copyright notice and the permission notice.

aulneau commented 2 years ago

as i commented in https://github.com/bitcoinjs/bip39/issues/170, there is @scure/bip39 which works in all modern bundlers, is much lighter, and supports ESM

-> https://github.com/paulmillr/scure-bip39