npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@milencode/bundlewatch-lighthouse-plugin

v2.2.4

Published

Optional Lighthouse integration for Bundle Watch. Correlate bundle size changes with real-world performance metrics.

Downloads

259

Readme

@bundlewatch/lighthouse-plugin

Optional Lighthouse integration for Bundle Watch. Correlate bundle size changes with real-world performance metrics.

Features

  • 🔦 Lighthouse Audits: Run automated performance audits
  • 📊 Performance Correlation: See how bundle size affects Lighthouse scores
  • 🎯 Core Web Vitals: Track LCP, FCP, TBT, and CLS
  • 💡 Smart Insights: Get actionable recommendations

Installation

pnpm add -D @bundlewatch/lighthouse-plugin

Note: This plugin requires Chrome/Chromium to be installed.

Usage

With Vite Plugin

import { defineConfig } from 'vite';
import { bundleWatch } from '@bundlewatch/vite-plugin';
import { runLighthouse, correlateBundleAndPerformance } from '@bundlewatch/lighthouse-plugin';

export default defineConfig({
  plugins: [
    bundleWatch({
      enabled: true,
      async onMetricsCollected(metrics, baseline) {
        // Start your preview server first
        const lighthouse = await runLighthouse({
          url: 'http://localhost:4173',
          headless: true,
        });

        const correlation = correlateBundleAndPerformance(
          metrics,
          baseline,
          lighthouse
        );

        console.log(correlation.insights.join('\n'));
      },
    }),
  ],
});

With CLI

import { collectMetrics } from '@bundlewatch/core';
import { runLighthouse, formatLighthouseReport } from '@bundlewatch/lighthouse-plugin';

// Collect bundle metrics
const metrics = await collectMetrics({
  outputDir: './dist',
  branch: 'main',
});

// Run Lighthouse audit
const lighthouse = await runLighthouse({
  url: 'http://localhost:4173',
});

// Print report
console.log(formatLighthouseReport(lighthouse));

API

runLighthouse(options)

Runs a Lighthouse audit on a URL.

Options:

  • url (string): URL to test (default: http://localhost:4173)
  • config (object): Lighthouse config overrides
  • chromeFlags (string[]): Chrome flags to pass
  • headless (boolean): Run Chrome headless (default: true)

Returns: Promise<LighthouseMetrics>

correlateBundleAndPerformance(current, baseline, lighthouse, baselineLighthouse?)

Correlates bundle size changes with Lighthouse performance metrics.

Returns: CorrelationResult with insights like:

  • "Bundle size increased by 15.2% and Performance score dropped 8 points"
  • "LCP is 3.2s (target: <2.5s). Consider code splitting or lazy loading."

formatLighthouseReport(metrics, delta?)

Formats Lighthouse metrics for console output.

Example Output

🔦 Lighthouse Performance Metrics
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Performance:     87/100 (-5)
Accessibility:   95/100
Best Practices:  92/100
SEO:             100/100

Core Web Vitals:
  LCP:  2.1s (+0.3s)
  FCP:  1.2s (+0.1s)
  TBT:  150ms (+50ms)
  CLS:  0.05

⚠️  Bundle size increased by 12.3% and Performance score dropped 5 points
🟡 Performance score is 87/100. There's room for improvement.

License

MIT