iroha-javascript
iroha-javascript copied to clipboard
`@iroha2/crypto-target-web` doesn't work with Vite out of the box
Issue
This code fails in Vite:
import { init } from '@iroha2/crypto-target-web'
await init()
Reproduction
https://github.com/0x009922/iroha-js-sdk-issue-104-repro
It includes error details.
Workaround
Using ?url suffix:
import { init } from '@iroha2/crypto-target-web'
import WASM_URL from '@iroha2/crypto-target-web/wasm-pkg/iroha_crypto_bg.wasm?url'
init(WASM_URL).then(() => {/* ... */})