chia-utils
chia-utils copied to clipboard
Can't import properly in Vue 2.x app
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.
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.