Created
May 3, 2021 07:26
-
-
Save jaydenseric/f8a2d7f3d920f2068de3c958fb6f3d58 to your computer and use it in GitHub Desktop.
How to get the `__dirname` in a Node.js ESM module.
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
import { fileURLToPath } from '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