Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bingo347/commonjs-variables-for-esmodules
Simple function for extract node variables __dirname, __filename, require and module from import.meta
https://github.com/bingo347/commonjs-variables-for-esmodules
commonjs esmodules nodejs
Last synced: 19 days ago
JSON representation
Simple function for extract node variables __dirname, __filename, require and module from import.meta
- Host: GitHub
- URL: https://github.com/bingo347/commonjs-variables-for-esmodules
- Owner: bingo347
- License: mit
- Created: 2020-04-26T05:54:30.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-04-30T12:04:50.000Z (over 4 years ago)
- Last Synced: 2024-11-27T19:50:27.749Z (about 1 month ago)
- Topics: commonjs, esmodules, nodejs
- Language: JavaScript
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# commonjs-variables-for-esmodules
Simple function for extract node variables __dirname, __filename, require and module from import.meta
## Install
```bash
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
```javascript
import commonjsVariables from 'commonjs-variables-for-esmodules';const {
__filename,
__dirname,
require,
module
} = commonjsVariables(import.meta);
```## License
MIT