Native ESM (Node 13+) Support
envgap__cacjs__cac-85
01 / FAILURE SIGNATURE
As reported upstream
No identifying execution failure has been captured.
Not a benchmark task.
- In a clean container the reported failure did not reproduce, or the known fix did not make the project run.
02 / ENVIRONMENT RECIPE
- Base commit
1312d62f5c79bbd8ee0b53c40721055cb1e0ead6- Manifest
package.json- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
cacjs/cac #85 · read the original issue
## Issue Type
<!--
Select the type by adding a `x` inside the brackets
e.g. - [x] Bug Report
-->
- [ ] Bug Report
- [x] Feature Request
- [ ] Other
## Expected
ESM support so we can do this:
```js
import cac from 'cac'
const cli = cac()
// ...
```
## Actual
No ESM support for Node.js
## Possible Solutions
Adding these fields to package.json
```json
"type": "module",
"module: "...",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./package.json": "./package.json",
"./": "./"
}
```
Note that CJS will still work as before, here's an example of such module: https://github.com/talentlessguy/es-mime-types
Because this project already uses Rollup, it will be very easy to add a module target.
## Info
- CAC version: 6.15.3
if needed, I can make a pull request04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]