Skip to content

Commit 8f9dfec

Browse files
committed
Use ESM way to determine runtime path
1 parent f6d8303 commit 8f9dfec

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

cli/common/runtime.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// @ts-check
2-
import { createRequire } from "node:module";
2+
import { fileURLToPath } from "node:url";
33
import * as path from "node:path";
44

5-
const require = createRequire(import.meta.url);
5+
const runtimePackageJsonUrl = await import.meta.resolve(
6+
"@rescript/runtime/package.json",
7+
);
8+
const runtimePackageJsonPath = fileURLToPath(runtimePackageJsonUrl);
69

7-
const runtimePackageJson = require.resolve("@rescript/runtime/package.json");
8-
9-
export const runtimePath = path.dirname(runtimePackageJson);
10+
export const runtimePath = path.dirname(runtimePackageJsonPath);

0 commit comments

Comments
 (0)