Skip to content

Instantly share code, notes, and snippets.

@oshinko
Created December 19, 2021 04:19
Show Gist options
  • Save oshinko/1a5da44318152db92d46973e29e9b91c to your computer and use it in GitHub Desktop.
Save oshinko/1a5da44318152db92d46973e29e9b91c to your computer and use it in GitHub Desktop.
Alternative to __dirname when using ESM
import path from 'path'
import url from 'url'
const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment