provides utilities for nodejs to be able to resolve es modules, such as providing the __dirname and __filename variables
npm install common-es__dirname and __filename variables."type": "module" option set in your package.json file. In order to get the functionality of these nonexistent variables, you have to do a bit of work manually.ts
// # myProjectFile.js
import { getGlobals } from 'common-es'
const { __dirname, __filename } = getGlobals(import.meta.url)
// now you can use __dirname or file name normally as you would do in commonjs
// ...
// ...
`
API
`
getGlobals(url: string): { __dirname: string, __filename: string }
`
a function that provides the \_\_dirname and \_\_filename variables.
Expects a string, this string is always the import.meta.url`.