Commit 4eaa5bb
fix(build): bundle @scure/bip39 into main (ESM-only, avoid ERR_REQUIRE_ESM) (#29)
@scure/bip39 + @noble/hashes are ESM-only ("type":"module"). electron-vite
externalizes deps for the main process by default, so a CJS main require()-ing
them throws ERR_REQUIRE_ESM at runtime — when the vault recovery-phrase code
loads, not at build (tsc/CI verify never catches it).
Exclude both from externalizeDepsPlugin so Rollup bundles them into the main
chunk instead. Verified against a packaged build: out/main has no external
require of @scure/@noble, generateMnemonic + the full BIP39 wordlist are inlined
in the recovery chunk, and the 11 recovery unit tests pass.
Co-authored-by: User <user@Users-MacBook-Pro-174.local>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 2dcdde1 commit 4eaa5bb
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
| |||
0 commit comments