#!/usr/bin/env -S JS_STDERR=err.txt /home/user/.jsvu/engines/spidermonkey/spidermonkey --enable-import-attributes --enable-top-level-await
import * as data from "./exports.json" with {type: "json"};
console.log(data);
When I put -m in a shebang line without a “test.js” value, that is, I’m referring to the current script beneath the shebang line the script exists.
In err.txt we see js is expecting a file name when -m is in shebang line, which means we would have to create another file to point to aqnd just use a shell script with -m test.js, instead of an -m without pointing to a separate file meaning refer to the current script.
Error: can't open --enable-import-attributes: No such file or directory
In V8’s d8 Ecmascipt Modules are supported out of the box. In QuickJS -m works on the shebang line out of the box, too
The -m option takes a filename argument. The #! invocation will append the script name to the end. So it should work with your env -S if you put -m at the end of the command line.
It works for me with jandem’s example. My shebang line is: #!/bin/env -S /home/sfink/src/mozilla4/obj-debug-js/dist/bin/js --enable-import-attributes -m