hyperledger / iroha-javascript

JavaScript library for Iroha, a Distributed Ledger Technology (blockchain) platform.
https://wiki.hyperledger.org/display/iroha
Apache License 2.0
94 stars 64 forks source link

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

Open 0x009922 opened 2 years ago

0x009922 commented 2 years ago

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