current-module-paths

Access to __filename and __dirname within ECMAScript modules

MIT 6 个版本
安装
npm install current-module-paths
yarn add current-module-paths
pnpm add current-module-paths
bun add current-module-paths
README

view on npm npm module downloads Gihub repo dependents Gihub package dependents Node.js CI

current-module-paths

Access to the CommonJS __filename and __dirname variables within ECMAScript modules.

Only use this module if your code depends on the above global variables being defined, otherwise use import.meta.

import currentModulePaths from 'current-module-paths'

const { __filename, __dirname } = currentModulePaths(import.meta.url)

© 2021-25 Lloyd Brookes <opensource@75lb.com>.

版本列表
1.1.3 2025-11-09
1.1.2 2024-08-24
1.1.1 2023-05-02
1.1.0 2021-08-13
1.0.0 2021-07-03
0.1.0 2021-04-25