Commit 43aa531
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
0 commit comments