require() of ES Module not supported
oskrcl opened this issue · comments
oskrcl commented
hey KaffinPX
after copying wasm from rusty-kaspa to kaspool, i got this error:
D:\Desarrollo\Kaspool\src\kaspa\index.js:3
const { RpcClient, Encoding, Address, NetworkType } = require('./wasm/kaspa_wasm')
^
Error [ERR_REQUIRE_ESM]: require() of ES Module D:\Desarrollo\Kaspool\src\kaspa\wasm\kaspa_wasm.js from D:\Desarrollo\Kaspool\src\kaspa\index.js not supported.
Instead change the require of kaspa_wasm.js in D:\Desarrollo\Kaspool\src\kaspa\index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (D:\Desarrollo\Kaspool\src\kaspa\index.js:3:55)
at Object.<anonymous> (D:\Desarrollo\Kaspool\index.js:1:15) {
code: 'ERR_REQUIRE_ESM'
}
Node.js v20.3.1
it's a normal error because experimental rusty? or a problem that can be solved (eg change node version, use import instead of require)?
oskrcl commented
my error...
building for web instead of node from rusty-kaspa.
wasm is available at https://aspectron.com/en/projects/kaspa-wasm.html