quickjs
quickjs copied to clipboard
__dirname is undefined in ESM build
Describe the bug Whe using enableTestUtils it in createVirtualFileSystem.js it attempts to use __dirname, which is undefined in ES Modules
To Reproduce Steps to reproduce the behavior: Run this example: https://github.com/sebastianwessel/quickjs/tree/main/example/run-tests
Expected behavior No Error
Desktop (please complete the following information): Node v24.11.0
Smartphone (please complete the following information): Ubuntu 24.04.3 LTS
Would expect something like
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
const __dirname = dirname(fileURLToPath(import.meta.url));