Last active
November 11, 2023 08:05
-
-
Save nichoth/5f4a3c06c5c643fa76a00d7a66ff261c to your computer and use it in GitHub Desktop.
__dirname in module
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
import path from 'path'; | |
import { fileURLToPath } from 'url'; | |
const __filename = fileURLToPath(import.meta.url); | |
const __dirname = path.dirname(__filename); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see https://flaviocopes.com/fix-dirname-not-defined-es-module-scope/