Skip to content

Commit 1a6d11f

Browse files
authored
fix: add exports to package.json
Add Node.JS export conditions to `package.json`, so that the examples of things like `import '@cypress/code-coverage/support'` continue to work in Node.JS v20.19.0. I believe I've added `package.json` too since it's theoretically possible somebody did `require("@cypress/code-coverage/package.json")`, so we should support that too. See: https://nodejs.org/api/packages.html#exports
1 parent 2b78406 commit 1a6d11f

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

package.json

+18-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "@cypress/code-coverage",
33
"version": "0.0.0-development",
44
"description": "Saves the code coverage collected during Cypress tests",
5-
"main": "index.js",
65
"scripts": {
76
"start": "parcel serve cypress/index.html",
87
"coverage:verify": "npx nyc report --check-coverage true --lines 80",
@@ -24,6 +23,24 @@
2423
"cypress": "*",
2524
"webpack": "^4 || ^5"
2625
},
26+
"exports": {
27+
"./common-utils": "./common-utils.js",
28+
"./cypress-config": "./cypress-config.js",
29+
"./middleware/express": "./middleware/express.js",
30+
"./middleware/hapi": "./middleware/hapi.js",
31+
"./middleware/nextjs": "./middleware/nextjs.js",
32+
"./package.json": "./package.json",
33+
"./plugins": "./plugins.js",
34+
"./support-utils": "./support-utils.js",
35+
"./support": "./support.js",
36+
"./task-utils": "./task-utils.js",
37+
"./task": {
38+
"types": "./task.d.ts",
39+
"default": "./task.js"
40+
},
41+
"./use-babelrc": "./use-babelrc.js",
42+
"./*.js": "./*.js"
43+
},
2744
"repository": {
2845
"type": "git",
2946
"url": "https://github.com/cypress-io/code-coverage.git"

0 commit comments

Comments
 (0)