Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project would attempt to use native utils in the browser #6

Open
andrewgordstewart opened this issue Sep 22, 2020 · 1 comment
Open

Comments

@andrewgordstewart
Copy link
Contributor

If I want to use @statechannels/native-utils in the browser, and I happen to not have rust installed locally, then this library will fallback to the bindings to the precompiled WASM. Everything will work.

If I want to use @statechannels/native-utils in the browser, and I happen to have rust installed locally, then this library will compile and create the neon bindings, and will then attempt to use a native binary in the browser. It won't work.

@andrewgordstewart
Copy link
Contributor Author

andrewgordstewart commented Sep 22, 2020

One solution is:

  • the install script always attempts to create bindings to a native binary, if rust is present.

  • the library uses the native binary if both:

    1. the environment a node environment and not a browser environment; and
    2. the bindings to a native binary is available
    • Otherwise, the library uses the bindings to the precompiled WASM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant