Describe the bug
When using the exports field in package.json on a package that still needs to support the older require syntax, you need to include require as one of the exports. Otherwise, you get ERR_PACKAGE_PATH_NOT_EXPORTED. Because of this, anyone using the older syntax on feed 5.2.0 is broken.
To Reproduce
Steps to reproduce the behavior:
- Create a file that imports the feed package using require, such as
const Feed = require('feed').Feed;
- Attempt to run the script.
- See error
Expected behavior
If you update package.json to:
"exports": {
".": {
"import": "./lib/feed.js",
"require": "./lib/feed.js",
"types": "./lib/feed.d.ts"
}
},
The script resumes working.
Actual behavior
The script crashes with a Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined error.
Versions (please complete the following information):
- NodeJS: 20.19.6
- TypeScript: n/a
- npm/yarn: npm 11.6.3
- feed: 5.2.0
Describe the bug
When using the
exportsfield inpackage.jsonon a package that still needs to support the olderrequiresyntax, you need to includerequireas one of the exports. Otherwise, you getERR_PACKAGE_PATH_NOT_EXPORTED. Because of this, anyone using the older syntax on feed 5.2.0 is broken.To Reproduce
Steps to reproduce the behavior:
const Feed = require('feed').Feed;Expected behavior
If you update package.json to:
The script resumes working.
Actual behavior
The script crashes with a
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main definederror.Versions (please complete the following information):