second-state / wasmedge-quickjs

A high-performance, secure, extensible, and OCI-complaint JavaScript runtime for WasmEdge.
Apache License 2.0
477 stars 59 forks source link

fs.FileHandle is not defined or not a function #129

Open lastmjs opened 7 months ago

lastmjs commented 7 months ago

I'm coming across a lot of strange issues with how things are exported in these JS files. The combination of ES modules while using these ES modules in an environment that expects CommonJS and requires is causing troubles.

Here's one of them: https://github.com/second-state/wasmedge-quickjs/blob/main/modules/internal/fs/stream.js#L210

This execution path does not work in our environment. fs.FileHandle is not defined or is not a function. To resolve it I had to change the imports at the top to this: import fs, { open, write, close, statSync, FileHandle } from "../../fs";

Similar problems happen elsewhere, the ES module interoperation seems off.