Skip to content

Instantly share code, notes, and snippets.

@Lokua
Last active July 24, 2023 18:23
Show Gist options
  • Save Lokua/b88fb2221ace81dc5ae5084f8cdd610e to your computer and use it in GitHub Desktop.
Save Lokua/b88fb2221ace81dc5ae5084f8cdd610e to your computer and use it in GitHub Desktop.
import { dirname } from 'path'
import { fileURLToPath } from 'url'
export const getDirname = (importMetaUrl) =>
dirname(fileURLToPath(importMetaUrl))
// use as `getDirname(import.meta.url)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment