https://github.com/noyobo/esm-cjs
Transform ESM to Common JS for present NodeJS, without any junk wrappers or useless renaming.
https://github.com/noyobo/esm-cjs
cjs esm esm2cjs
Last synced: 4 months ago
JSON representation
Transform ESM to Common JS for present NodeJS, without any junk wrappers or useless renaming.
- Host: GitHub
- URL: https://github.com/noyobo/esm-cjs
- Owner: noyobo
- License: mit
- Created: 2021-01-21T07:44:48.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-06-04T11:00:34.000Z (about 4 years ago)
- Last Synced: 2025-06-30T03:43:51.543Z (about 1 year ago)
- Topics: cjs, esm, esm2cjs
- Language: JavaScript
- Homepage:
- Size: 216 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# esm-cjs
[](https://github.com/noyobo/esm-cjs/actions?query=workflow%3ATesting) [](https://codecov.io/gh/noyobo/esm-cjs/branch/main) [](https://www.npmjs.org/package/esm-cjs) [](https://npmjs.org/package/esm-cjs)
Transform ESM to Common JS for present NodeJS, without any junk wrappers or useless renaming.
## Usage
```js
const esm2cjs = require('esm-cjs');
const input = `import { bar } from 'foo';`;
const output = esm2cjs(input);
// const { bar } = require('foo');
```
## Command line
```bash
ej --help
ej ./**/*.js --write
```
## TODO
- [ ] Aggregating modules