Skip to content

Commit 4ca50ca

Browse files
author
Andrei Bratu
authored
Merge pull request #12 from lukehrucker/import-p-map-dynamically
Dynamically import p-map
2 parents 5fce6f4 + dfd94ca commit 4ca50ca

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,
@@ -488,6 +487,10 @@ export async function runEval(
488487
);
489488
const totalDatapoints = hlDataset.datapoints!.length;
490489
progressBar.start(totalDatapoints, 0);
490+
491+
// p-map is esm only since v5. Since we're targeting cjs, we need to
492+
// import it dynamically, so it works for both cjs and esm consumers on node < 22.
493+
const { default: pMap } = await import("p-map");
491494
await pMap(
492495
hlDataset.datapoints!,
493496
async (datapoint) => {

0 commit comments

Comments
 (0)