diff --git a/lib/runner.js b/lib/runner.js index e3500ab..4d525b4 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -1,4 +1,4 @@ -const lighthouse = require('lighthouse'); +// lighthouse is ESM only, imported dynamically const chromeLauncher = require('chrome-launcher'); const fs = require('fs'); const path = require('path'); @@ -11,6 +11,9 @@ const { v4: uuidv4 } = require('uuid'); * @returns {Promise} - Test results */ async function runTest(url, options = {}) { + // Dynamically import Lighthouse (ESM) + const { default: lighthouse } = await import('lighthouse'); + const isMobile = options.isMobile ?? true; // Default to mobile const reportDir = path.join(__dirname, '..', 'reports');