bitauth / libauth

An ultra-lightweight, zero-dependency TypeScript library for Bitcoin Cash, Bitcoin, and Bitauth applications.

Home Page:https://libauth.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is running inside a browser really supported?

mariusk opened this issue · comments

The docs state that it is, and recommends a builder/bundler etc. I'm using vite, and when importing libauth in an otherwise working project I get:

[vite] ✘ [ERROR] Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)
[vite]     node_modules/@bitauth/libauth/build/lib/crypto/default-crypto-instances.js:6:53:
[vite]       6 │ ... [sha1, sha256, sha512, ripemd160, secp256k1] = await Promise.all([
[vite]         ╵                                                    ~~~~~

So is it supporte, and if so, what is needed to get it working?

Thanks, with some messing around with the vite config that works.