Last active
September 2, 2022 15:34
-
-
Save jrc03c/6fbccd5af3a4d1b61f12e1e620e1c01b to your computer and use it in GitHub Desktop.
Create `__dirname` variable when using `import` statements in Node
This file contains hidden or 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
const __dirname = path.resolve( | |
import.meta.url.replace("file://", "").split("/").slice(0, -1).join("/") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment