bitcoinjs / tiny-secp256k1

A tiny secp256k1 native/JS wrapper
MIT License
92 stars 54 forks source link

Wrong path when bundling tiny-secp256k1 with Electron #92

Open electic opened 2 years ago

electic commented 2 years ago

Hello,

First off thank you for making this library. Secondly, we are having issues bundling this with Electron and Electron Builder. The issue is that during the bundling process the following file:

wasm_path.js uses import.meta.url.

Using webpack, when it is packaged and built, it uses the path of the wasm file on the build machine. Instead of the where it is relative to where it running on the target machine. Disabling that behavior in webpack using:

 module: {
        parser: {
            javascript : { importMeta: false }
        }
    }

Does not seem to work because it then throws another error that import.meta.url cannot be used outside of a module. I have a feeling others will run into this issue. For now, we have copied the wasm file out and patched the file to look for it relative to the installation path. Any help here appreciated. Happy to help debug.

iknowhtml commented 1 year ago

@electic, I believe I am running into the same issue you are. Is it possible for you to share a redacted version of your solution?