Need private packages and team management tools?Check out npm Teams »

module-scope

1.1.0 • Public • Published

module-scope

📍 __dirname and __filename in native harmony modules

When running native harmony modules (node --experimental-modules myapp) the classic module scope signature is not available (exports, require, module, __filename, __dirname).

This module helps getting __dirname and __filename values easily by import.meta.url:

import scope from 'module-scope';
 
const {__dirname, __filename} = scope(import.meta.url);

Or get corresponding names without the underscores

const {dirname, filename} = scope(import.meta.url);

Install

npm i module-scope

DownloadsWeekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

2.34 kB

Total Files

4

Last publish

Collaborators

  • avatar