bitcoinjs / tiny-secp256k1

A tiny secp256k1 native/JS wrapper
MIT License
90 stars 55 forks source link

Cannot load wasm on Windows #64

Closed Jack-Works closed 2 years ago

Jack-Works commented 2 years ago
 ENOENT: no such file or directory, open '/C:/Users/Jack/Workspace/Mask/node_modules/.pnpm/tinysecp256k1@2.0.0/node_modules/tiny-secp256k1/lib/secp256k1.wasm'

Note: You cannot pass new URL(...).pathname to fs.readFileSync because it creates an invalid path on Windows.

The correct way to do this is:

import { fileURLToPath } from 'url'
const __dirname = fileURLToPath(new URL('.', import.meta.url))
console.log(__dirname)
junderw commented 2 years ago

Published v2.1.2

junderw commented 2 years ago

Perhaps this could be prevented by running tests in a windows container on Github Actions...

I might look into that later, if you know anything and want to make a PR I'd appreciate it. Thanks.