Skip to content

Instantly share code, notes, and snippets.

@jonathantneal
Last active October 26, 2022 07:20
Show Gist options
  • Save jonathantneal/72f28886f901e952c5bf5da20e828488 to your computer and use it in GitHub Desktop.
Save jonathantneal/72f28886f901e952c5bf5da20e828488 to your computer and use it in GitHub Desktop.
Executable JavaScript Modules
":" //#;exec /usr/bin/env node --input-type=module - $@<$0
import process from 'process'
const { argv } = process
console.log(argv)
@subtleGradient
Copy link

Ran into an issue where prettier added a semicolon after ":" which broke this.
Adding prettier-ignore fixed it

":" /*prettier-ignore*/ //#;exec /usr/bin/env node --input-type=module - "$@" < "$0"

https://gist.github.com/subtleGradient/efb9bbea1400bc948b06859652c56d75/revisions#diff-c9a3d2ed9bfa0b7fa4f5ab7921276d3df64c217d65f4ef3878bd64ac2eb41008R1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment