mesh icon indicating copy to clipboard operation
mesh copied to clipboard

Cannot read properties of undefined (reading 'PrivateKey') using Vite (Vue3/Nuxt)

Open PalmerEk opened this issue 1 year ago • 6 comments

Receive the error

Cannot read properties of undefined (reading 'PrivateKey')

when including Mesh in Vue 3 / Nuxt based projects.

Appears to be an issue with importing @stricahq/* (and @emurgo/cip14-js)

PalmerEk avatar Aug 12 '24 15:08 PalmerEk

Can't seem to create a branch/submit PR but the fix is to change the following import declarations to namespace:

mesh/packages/mesh-common/src/utils/asset-fingerprint.ts import * as CIP14 from "@emurgo/cip14-js";

mesh/packages/mesh-core-cst/src/stricahq/bip32ed25519/index.ts import * as strica from "@stricahq/bip32ed25519";

mesh/packages/mesh-core-cst/src/stricahq/cbors/index.ts import * as strica from "@stricahq/cbors";

mesh/packages/mesh-core-cst/src/stricahq/bip32ed25519/privateKey.ts
import * as strica from "@stricahq/bip32ed25519";

PalmerEk avatar Aug 12 '24 15:08 PalmerEk

Same issue here. My project used the ^1.5.4 and then this allow to be resolved to 1.6.4 and crashed with this error. The whole app crashed so I had to fix the version to 1.5.4

The only difference is that I was using React.

NanezX avatar Aug 12 '24 20:08 NanezX

working on it

jinglescode avatar Aug 13 '24 00:08 jinglescode

@PalmerEk would you mind sharing your vite.config.js? I had a vite project that was working, and then suddenly it stopped. I'm getting the same errors you are. I've downgraded to old versions and it's still happening. I'm puzzled.

tabdon avatar Aug 13 '24 16:08 tabdon

@PalmerEk @NanezX @tabdon try version 1.6.5

jinglescode avatar Aug 14 '24 02:08 jinglescode

@jinglescode so far so good! thanks!

tabdon avatar Aug 17 '24 12:08 tabdon