Skip to content

Instantly share code, notes, and snippets.

@Nekall
Created October 4, 2023 13:11
Show Gist options
  • Save Nekall/d768da511224cc430edc65c62c7726e3 to your computer and use it in GitHub Desktop.
Save Nekall/d768da511224cc430edc65c62c7726e3 to your computer and use it in GitHub Desktop.
Marre de redéclarer le __dirname partout.
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
export const __dirname = join(dirname(fileURLToPath(import.meta.url)), '..') // '..' dans le cas ou il est dans un dossier utils par exemple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment