iroha-javascript icon indicating copy to clipboard operation
iroha-javascript copied to clipboard

`@iroha2/crypto-target-web` doesn't work with Vite out of the box

Open 0x009922 opened this issue 3 years ago • 0 comments

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(() => {/* ... */})

0x009922 avatar May 24 '22 16:05 0x009922