Skip to content

Commit 47f3467

Browse files
committed
Fixes: dynamic import() to load ESM-only dependency
1 parent 89e2bfe commit 47f3467

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.changeset/curly-balloons-fry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@react-router/dev": patch
3+
---
4+
5+
Use a dynamic `import()` to load ESM-only `p-map` dependency to avoid issues on Node 20.18 and below

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/vite/plugin.ts

Lines changed: 2 additions & 2 deletions
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,7 +2814,8 @@ async function handlePrerender(
28152814
concurrency = prerender.unstable_concurrency ?? 1;
28162815
}
28172816

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

28212821
function getStaticPrerenderPaths(routes: DataRouteObject[]) {

0 commit comments

Comments
 (0)