Last active
May 24, 2024 07:59
-
-
Save phanect/ac21182ea67cfe74471ff2c9217c99f3 to your computer and use it in GitHub Desktop.
JSM (JavaScript modules, aka. ESM) Template for task scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Deprecated: Use import.meta.dirname instead. | |
* https://nodejs.org/api/esm.html#importmetadirname | |
*/ | |
import { fileURLToPath } from "node:url"; | |
const __filename = fileURLToPath(import.meta.url); | |
const __dirname = fileURLToPath(new URL(".", import.meta.url)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reference: https://blog.logrocket.com/alternatives-dirname-node-js-es-modules/