We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch @cypress-audit/[email protected] for the project I'm working on.
@cypress-audit/[email protected]
I got an error when I upgraded lighthouse to version 12.x and the error was "lighthouseLib is not a function" Here is the diff that solved my problem:
diff --git a/node_modules/@cypress-audit/lighthouse/src/task.js b/node_modules/@cypress-audit/lighthouse/src/task.js index 72a6526..5553930 100644 --- a/node_modules/@cypress-audit/lighthouse/src/task.js +++ b/node_modules/@cypress-audit/lighthouse/src/task.js @@ -1,13 +1,8 @@ -const lighthouseLib = require("lighthouse/core/index.cjs").legacyNavigation; -const { - computeCategories, - computeAudits, - compareWithThresholds, -} = require("./helpers"); +const { computeCategories, computeAudits, compareWithThresholds } = require('./helpers'); const lighthouse = (callback) => - ({ url, thresholds, opts = {}, config }) => { + async ({ url, thresholds, opts = {}, config }) => { if (global.cypress_audit_port) { opts.port = global.cypress_audit_port; @@ -19,10 +14,13 @@ const lighthouse = opts.disableStorageReset = true; } - return lighthouseLib(url, opts, config).then((results) => { - if (callback) { - callback(results); - } + // Use dynamic import for 'lighthouse' + const lighthouse = (await import('lighthouse')).default; + + return lighthouse(url, opts, config).then((results) => { + if (callback) { + callback(results); + } const computedAudits = computeAudits(results.lhr.audits); const computedCategories = computeCategories(results.lhr.categories);
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
@cypress-audit/[email protected]
for the project I'm working on.I got an error when I upgraded lighthouse to version 12.x and the error was "lighthouseLib is not a function"
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: