commonjs-variables-for-esmodules
v1.1.0
Published
Simple function for extract node variables __dirname, __filename, require and module from import.meta
Downloads
38
Maintainers
Readme
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