← All tasks
javascriptrvagg/through2 #119Not a task: already works

Add `require` entries to `exports` for Node/CommonJS compatibility

envgap__rvagg__through2-119

01 / FAILURE SIGNATURE

As reported upstream

Error processing "tsconfig": Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/.../some-package/node_modules/through2/package.json
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
ec5688df25b450001036f2f3116404dd54073b82
Manifest
package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

rvagg/through2 #119 · read the original issue
When `through2` is consumed by Node.js libraries, I get:

```txt
Error processing "tsconfig": Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/.../some-package/node_modules/through2/package.json
```

It looks like the package `exports` map only exposes `import` and `types`. Adding `require` entries would make it compatible with CommonJS consumers as well:

```json
"exports": {
  ".": {
    "import": "./through2.js",
    "require": "./through2.js",
    "types": "./types/through2.d.ts"
  },
  "./web": {
    "import": "./web.js",
    "require": "./web.js",
    "types": "./types/web.d.ts"
  }
}
```
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]