quickjs icon indicating copy to clipboard operation
quickjs copied to clipboard

__dirname is undefined in ESM build

Open digipigeon opened this issue 1 month ago • 0 comments

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));

digipigeon avatar Nov 25 '25 11:11 digipigeon