-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Description
Coming from this comment: nodejs/modules#151 (comment)
It is now possible to create executable, extension-less, files:
#!/usr/bin/env node
console.log(__filename);But it's not possible to enable ESM as parsing goal.
#!/usr/bin/env node -m
console.log(import.meta.url);Even if there are OS incapable to parse the whole shebang up to the -m flag (or whatever flag will land in nodejs), there is no way to even define an executable that would like to parse the source file without any extension.
Example
Given the following esm file, reachable through /usr/local/bin or similar OS folder:
#!/usr/bin/env bash
node --module $1And given the following executable:
#!/usr/bin/env esm
console.log(import.meta.url);It should be possible to have extensions-less files parsable as ESM.
Update
There is a solution to the single file problem that would still require --module hook to bootstrap the file as ESM parse goal.
targos, ljharb, v1rtl, stevenjoezhang, sadeghbarati and 4 more
Metadata
Metadata
Assignees
Labels
No labels