Skip to content

Commit ed4359c

Browse files
committed
[Fix:Node-v20]: Dynamic inline import for p-map
1 parent 89e2bfe commit ed4359c

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,3 +452,4 @@
452452
- zeromask1337
453453
- zheng-chuang
454454
- zxTomw
455+
- HeyyyNeo

packages/react-router-dev/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# `@react-router/dev`
22

3+
## 7.9.6
4+
5+
### ESM import changes for p-map in vite plugin.ts
6+
7+
- Introduce a `dynamic inline import for p-map` in vite plugin.ts to resolve node v20 bug. ([#14492](https://github.com/remix-run/react-router/pull/14492))
8+
9+
```tsx
10+
import pMap from "p-map";
11+
// older code
12+
const pMap = (await import("p-map")).default;
13+
// dynamic inline import (this works fine)
14+
```
15+
316
## 7.9.5
417

518
### Patch Changes

packages/react-router-dev/vite/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import pick from "lodash/pick";
3636
import jsesc from "jsesc";
3737
import colors from "picocolors";
3838
import kebabCase from "lodash/kebabCase";
39-
import pMap from "p-map";
4039

4140
import * as Typegen from "../typegen";
4241
import type { RouteManifestEntry, RouteManifest } from "../config/routes";
@@ -2815,6 +2814,7 @@ async function handlePrerender(
28152814
concurrency = prerender.unstable_concurrency ?? 1;
28162815
}
28172816

2817+
const pMap = (await import("p-map")).default;
28182818
await pMap(build.prerender, prerenderSinglePath, { concurrency });
28192819
}
28202820

0 commit comments

Comments
 (0)