Execute ES Modules on the CLI

Jonathan Neal shared this little snippet on Twitter: Execute JavaScript modules like: bash ./command.js 1. Add the funky header.2. Optional: Omit the extension to not write `.js`.3. Optional: `chmod +x command` to not write `bash `.https://t.co/rhlPg2XPRJ pic.twitter.com/nbAvTFtt0w — Jonathan Neal (@jon_neal) July 25, 2021 Here’s the code: “:” //#;exec /usr/bin/env node –input-type=module – “$@” < …