Skip to content

Commit

Permalink
Use import.meta.resolve in benchmark setup (#4179)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewiggins committed Oct 30, 2023
1 parent 62c050f commit 12f92e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
1 change: 1 addition & 0 deletions benches/jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"target": "es2020",
"module": "es2020",
"checkJs": true,
"moduleResolution": "node"
},
Expand Down
8 changes: 1 addition & 7 deletions benches/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ import * as path from 'path';
import escalade from 'escalade';
import { globby } from 'globby';

// TODO: Replace with import.meta.resolve when stable
import { createRequire } from 'module';
// @ts-ignore
const require = createRequire(import.meta.url);

export const IS_CI = process.env.CI === 'true';

// @ts-ignore
Expand All @@ -28,8 +23,7 @@ export async function getPkgBinPath(pkgName) {
/** @type {string | void} */
let packageJsonPath;
try {
// TODO: Replace with import.meta.resolve when stable
const pkgMainPath = require.resolve(pkgName);
const pkgMainPath = await import.meta.resolve(pkgName);
packageJsonPath = await escalade(pkgMainPath, (dir, names) => {
if (names.includes('package.json')) {
return 'package.json';
Expand Down

0 comments on commit 12f92e0

Please sign in to comment.