I’ve enabled the lighthouse plugin for my site, but I get this error:
1:33:13 PM: Generating Lighthouse report. This may take a minute…
1:33:13 PM: Running Lighthouse on docs/
1:33:13 PM: Serving and scanning site from directory docs
1:33:19 PM: ERRORED_DOCUMENT_REQUEST
1:33:19 PM: Lighthouse was unable to reliably load the page you requested. Make sure you are testing the correct URL and that the server is properly responding to all requests. (Status code: 404)
docs/ is my base directory. The site works - all content is served from that directory.
By default, the plugin will serve and audit the build directory of the site, inspecting the index.html . You can customize the behavior via the audits input:
[[plugins]]
package = "@netlify/plugin-lighthouse"
[plugins.inputs.thresholds]
performance = 0.9
# to audit a sub path of the build directory
# route1 audit will use the top level thresholds
[[plugins.inputs.audits]]
path = "route1"
# you can specify output_path per audit, relative to the path
output_path = "reports/route1.html"
# to audit an HTML file other than index.html in the build directory
[[plugins.inputs.audits]]
path = "contact.html"
# to audit an HTML file other than index.html in a sub path of the build directory
[[plugins.inputs.audits]]
path = "pages/contact.html"
# to audit a specific absolute url
[[plugins.inputs.audits]]
url = "https://www.example.com"
# you can specify thresholds per audit
[plugins.inputs.audits.thresholds]
performance = 0.8
# to serve only a sub directory of the build directory for an audit
# pages/index.html will be audited, and files outside of this directory will not be served
[[plugins.inputs.audits]]
serveDir = "pages"