Splendid UI
Components and utilities for the modern web
-->
dirname
is a utility that lets you get the directory of the current file easily when you use ESM with Node. If you are using CJS, just use __dirname
.
First, make sure you install Splendid UI.
npm install splendid-ui
Then import dirname
into your project.
import { dirname } from 'splendid-ui/node'
Just pass import.meta.url
into dirname
and you will get the directory.
const __dirname = dirname(import.meta.url)