Skip to content

Commit dfd94ca

Browse files
committed
Dynamically import p-map
1 parent 20faca0 commit dfd94ca

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/eval_utils/run.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import cliProgress from "cli-progress";
1111
import { Humanloop, HumanloopClient } from "index";
1212
import _ from "lodash";
13-
import pMap from "p-map";
1413

1514
import {
1615
BooleanEvaluatorStatsResponse,
@@ -484,6 +483,10 @@ export async function runEval(
484483
);
485484
const totalDatapoints = hlDataset.datapoints!.length;
486485
progressBar.start(totalDatapoints, 0);
486+
487+
// p-map is esm only since v5. Since we're targeting cjs, we need to
488+
// import it dynamically, so it works for both cjs and esm consumers on node < 22.
489+
const { default: pMap } = await import("p-map");
487490
await pMap(
488491
hlDataset.datapoints!,
489492
async (datapoint) => {

0 commit comments

Comments
 (0)