Skip to content

Commit

Permalink
chore: use dynamic import instead of require
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 committed Nov 12, 2024
1 parent 3071304 commit 592121d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions electron/spec-runner.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
/* eslint-disable @typescript-eslint/naming-convention */
/* eslint-disable @typescript-eslint/no-require-imports */

import * as childProcess from "node:child_process";
import * as crypto from "node:crypto";
import * as fs from "node:fs";
import * as path from "node:path";

export async function setupSpecRunner(electronRoot: string) {
const { hashElement } = require(
path.resolve(electronRoot, "node_modules", "folder-hash"),
const { hashElement } = await import(
path.resolve(electronRoot, "node_modules", "folder-hash", "index.js")
);

const SCRIPT_DIR = path.resolve(electronRoot, "script");

const utils = require(path.resolve(SCRIPT_DIR, "lib", "utils"));
const { YARN_VERSION } = require(path.resolve(SCRIPT_DIR, "yarn"));
const utils = await import(path.resolve(SCRIPT_DIR, "lib", "utils.js"));
const { YARN_VERSION } = await import(path.resolve(SCRIPT_DIR, "yarn.js"));

const BASE = path.resolve(electronRoot, "..");
const NPX_CMD = process.platform === "win32" ? "npx.cmd" : "npx";
Expand Down

0 comments on commit 592121d

Please sign in to comment.