[Fix] Add p-map override to fix ERR_REQUIRE_ESM errors in some environments #113
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
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.
WHY are these changes introduced?
Fixes #0000
WHAT is this pull request doing?
Test this PR
Checklist
README.mdfile and other related documentation, if applicableCHANGELOG.md