chia-utils icon indicating copy to clipboard operation
chia-utils copied to clipboard

Can't import properly in Vue 2.x app

Open tgarm opened this issue 3 years ago • 1 comments

I'm trying to use chia-utils in Vue 2 app, code looks like this in main.js:

import { puzzle_hash_to_address } from 'chia-utils'

The error message in browser (Firefox) is: Uncaught TypeError: window.Buffer is undefined chia-utils.js:9863

I guess it was because in Vue 2.x, window object only accessible after mounted, but chia-utils tried to access window.Buffer just inside import initialization code. Any way to solve this?

Thank you.

tgarm avatar Oct 21 '21 02:10 tgarm

We don't use ES6 imports (import ... from ...). Please reference our install instructions and try the NPM import. If that import doesn't work, you can try the browser import instead. Please let us know if using one of these two imports solves the issue.

CMEONE avatar Nov 21 '21 23:11 CMEONE