From f7a1f1be428009c28c262b53385c7682abfef31b Mon Sep 17 00:00:00 2001 From: DeNNiiInc Date: Sat, 27 Dec 2025 23:13:47 +1100 Subject: [PATCH] Fix ERR_REQUIRE_ESM: Use dynamic import for uuid --- lib/runner.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/runner.js b/lib/runner.js index 388fceb..5a39fd7 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -1,7 +1,6 @@ -// lighthouse & chrome-launcher are ESM only/compatible, imported dynamically +// lighthouse, chrome-launcher, uuid are ESM only/compatible, imported dynamically const fs = require('fs'); const path = require('path'); -const { v4: uuidv4 } = require('uuid'); /** * Run a performance test using Lighthouse @@ -10,9 +9,10 @@ const { v4: uuidv4 } = require('uuid'); * @returns {Promise} - Test results */ async function runTest(url, options = {}) { - // Dynamically import Lighthouse & Chrome Launcher (ESM) + // Dynamically import dependencies (ESM) const { default: lighthouse } = await import('lighthouse'); const { default: chromeLauncher } = await import('chrome-launcher'); + const { v4: uuidv4 } = await import('uuid'); const isMobile = options.isMobile ?? true; // Default to mobile const reportDir = path.join(__dirname, '..', 'reports');