Skip to content

Commit 43aa531

Browse files
committed
Add p-map override to fix ERR_REQUIRE_ESM errors in some environments
Fix ERR_REQUIRE_ESM errors that occur inconsistently across different Node.js and npm version combinations when running this app. The @react-router/dev v7.x dependency chain pulls in p-map@^7.0.3, which is ESM-only. The compiled @react-router/dev code uses require(p-map) in its vite.js file. While Node.js v22.12.0+ and v20.19.0+ support require(esm) by default, some users still encounter ERR_REQUIRE_ESM errors even on Node v23.10.0 with npm 11.6.2. The exact conditions causing the error are not fully understood, but forcing p-map@^4.0.0 (CommonJS-compatible) resolves it across all reported cases. This is safe because @react-router/dev only uses basic p-map features (array mapping + concurrency option) that exist in both v4 and v7.
1 parent 56d100f commit 43aa531

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
"type": "module",
2323
"engines": {
24-
"node": ">=20.10"
24+
"node": ">=20.19 <22 || >=22.12"
2525
},
2626
"dependencies": {
2727
"@prisma/client": "^6.16.3",
@@ -66,5 +66,8 @@
6666
},
6767
"trustedDependencies": [
6868
"@shopify/plugin-cloudflare"
69-
]
69+
],
70+
"overrides": {
71+
"p-map": "^4.0.0"
72+
}
7073
}

0 commit comments

Comments
 (0)