Skip to content

Lighthouse Config

@theholocron/lighthouse-config provides a shared Lighthouse CI assertion configuration used across theholocron front-end projects.

Terminal window
pnpm add -D @theholocron/lighthouse-config

In your lighthouserc.cjs:

const { defaultAssertions, defineConfig } = require("@theholocron/lighthouse-config");
module.exports = defineConfig({
url: "http://localhost:4321",
startServerCommand: "pnpm preview",
assertions: {
...defaultAssertions,
// override individual assertions as needed
"largest-contentful-paint": ["error", { minScore: 0.8 }],
},
});
Export Description
defineConfig Factory that produces a typed lighthouserc config object
defaultAssertions Pre-set assertion thresholds covering core Web Vitals and common audits
LighthouseAssertion Type for the assertions map
LighthouseConfigOptions Options type for defineConfig

The bundled defaultAssertions warn on the following audits falling below 0.9 (or exceeding 0 bytes where applicable):

bf-cache, errors-in-console, font-display, label, largest-contentful-paint, lcp-lazy-loaded, non-composited-animations, prioritize-lcp-image, unused-javascript, uses-long-cache-ttl