cashscript not working with latest version of vite
when using yarn create vue to initialize a default vue-vite app, cashscript import is broken.
first I ran into
Uncaught TypeError: class heritage import_events.EventEmitter is not an object or null
originating from
var ElectrumSocket = class extends import_events.EventEmitter {
I was able to solve this with
yarn add events
https://github.com/vitejs/vite/issues/2694
but new errors pop up:
Error: Build failed with 1 error:
node_modules/cashscript/dist/utils.js:1:256: ERROR: No matching export in "node_modules/@bitauth/libauth/build/index.js" for import "bigIntToCompactSize"
and
Uncaught SyntaxError: The requested module 'http://localhost:5173/node_modules/hash.js/lib/hash.js?v=fcabd058' doesn't provide an export named: 'default'
which has the comment // TODO: Replace with libauth
My issue was with using CashScript + Vite version ^5.3.1
Downgrading to Vite version 5.0.12 solved the issue
I having a similar issue with react/next, I can get it with next version 13.... but not 14...
so this issue is related to #222 which has now been resolved and will be published with release v0.10.2 next week
After removing hash-js from CashScript, CashScript works with vite when adding events for electrum-cash
To fix the vite build without any workaround, we need to update the electrum-cash package, as described in issue #224
fixed as of v0.11.0-next.2