I'm trying to work through the "Creating Components" > "JavaScript" section. Under the Exporting WIT Interfaces with jco section, I'm finding that the string-reverse example isn't working.
Steps to reproduce:
- Created a
wit/component.wit file as instructed, except that I had to edit it to fix a syntax error (missing semicolon after the package declaration).
- Created a
string-reverse.mjs file as instructed.
- Ran the
npx jco componentize command as instructed; note that I had to change --disable all to --disable=all.
- Ran the
npx jco transpile command as instructed.
- Added a
package.json file that looks like:
-
{
"name": "string-reverse",
"description": "Simple codebase for compiling a string reversing interface to WebAssembly with jco",
"type": "module"
}
(This step isn't in the docs, but if it's omitted, I get an error about modules when running the next step.)
- Saved the next bit of code (beginning with
import { reverse } to run.js.
node run.js
Result:
wasm://wasm/02a47f8a:1
RuntimeError: unreachable
at wasm://wasm/02a47f8a:wasm-function[3]:0x971c
at wasm://wasm/02a47f8a:wasm-function[4342]:0x1b4560
at example:string-reverse/reverse@0.1.0#reverse-string (wasm://wasm/02a47f8a:wasm-function[13444]:0x81449e)
at Object.reverseString (file:///home/tjc/wasm-scratch/js-example/string-reverse-2/dist/transpiled/string-reverse.js:668:15)
at file:///home/tjc/wasm-scratch/js-example/string-reverse-2/run.js:4:26
Node.js v22.18.0
I'll keep trying to debug this, but I was hoping someone else might be able to try reproducing it so I know whether it's some quirk of my setup.
npx jco --version prints "1.13.2".
I'm trying to work through the "Creating Components" > "JavaScript" section. Under the Exporting WIT Interfaces with jco section, I'm finding that the string-reverse example isn't working.
Steps to reproduce:
wit/component.witfile as instructed, except that I had to edit it to fix a syntax error (missing semicolon after thepackagedeclaration).string-reverse.mjsfile as instructed.npx jco componentizecommand as instructed; note that I had to change--disable allto--disable=all.npx jco transpilecommand as instructed.package.jsonfile that looks like:import { reverse }torun.js.node run.jsResult:
I'll keep trying to debug this, but I was hoping someone else might be able to try reproducing it so I know whether it's some quirk of my setup.
npx jco --versionprints "1.13.2".