-
Notifications
You must be signed in to change notification settings - Fork 9
package.json: define explicit exports to support CJS require in Node 18+ #1402
Copy link
Copy link
Closed
Description
Currently, the generated package.json on NPM lacks the require condition for ./eslint-plugin, causing builds to fail in Node 18+ environments (ERR_PACKAGE_PATH_NOT_EXPORTED).
By explicitly defining the exports map in the source package.json, we ensure the published package includes the correct require entry pointing to the compiled JS, allowing tools like jiti/eslint to load the plugin correctly.
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs.js"
},
"./dist/*": {
"import": "./dist/*",
"types": "./dist/*"
},
"./loader": {
"types": "./loader/index.d.ts",
"import": "./loader/index.js",
"require": "./loader/index.cjs.js"
},
"./eslint-plugin": {
"types": "./eslint-plugin/dist/index.d.ts",
"import": "./eslint-plugin/dist/index.js",
"require": "./eslint-plugin/dist/index.js",
"default": "./eslint-plugin/dist/index.js"
}
},
need add "require": "./eslint-plugin/dist/index.js",
"default": "./eslint-plugin/dist/index.js"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels