Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

esm-pathnames

BitYoungjae6MIT1.0.15TypeScript support: included

You can use __dirname and __filename when using ESM

__filename, __dirname, filename, dirname, commonjs, ecmascript, export, import, modules, node, require

readme

ESM-PathNames

You can use __dirname and __filename when using ESM(ECMAScript module).

Install

npm i esm-pathnames

Usage

import { getPathNames } from 'esm-pathnames';

const { __dirname, __filename } = getPathNames(import.meta);

Restrictions

  • The browser environment is not yet supported.