commonjs-variables-for-esmodules
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

commonjs-variables-for-esmodules

Simple function for extract node variables __dirname, __filename, require and module from import.meta

Install

npm install --save commonjs-variables-for-esmodules
# or 
yarn add commonjs-variables-for-esmodules

Limitations

  • node 12.2 or higher
  • use only in native ES modules

Usage

import commonjsVariables from 'commonjs-variables-for-esmodules';
 
const {
    __filename,
    __dirname,
    require,
    module 
= commonjsVariables(import.meta);

License

MIT

Package Sidebar

Install

npm i commonjs-variables-for-esmodules

Weekly Downloads

15

Version

1.1.0

License

MIT

Unpacked Size

4.28 kB

Total Files

6

Last publish

Collaborators

  • bingo347