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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vahor/next-broken-links

v0.4.1

Published

A tool to find broken links in your Next.js project

Readme

next-broken-links

Code quality npm downloads

About

This is a CLI tool that will check broken links in your Next.js project.

The experimental nextjs Statically Typed Links feature is not enough for catch all segments. This tool helps in that case.

Plus as we check links directly in the .next (or out) directory, we also check for broken links coming from CMS or other external sources. Whereas the next features is only limited to the <Link> tags present directly in the code.
But that's also a limit of our tool as we can only check server side rendered links.

Features

  • Check broken links for public assets (images, json etc...)
  • Check broken links for sitemap.xml
  • Check broken links for all <a> tags (including <Link>)
  • Check broken links for all <img> tags

Installation

bun install @vahor/next-broken-links -D

Usage

After a nextjs build, run the following command:

bunx @vahor/next-broken-links

or

bun next-broken-links

It will output the following:

✔ Extracted links from all pages
✔ Found 0 broken links

If you have broken links, it will output the following:

✔ Extracted links from all pages
✖ Found 5 broken links

index.html (4 broken links)
        - /hello/world/again
        - /incorrect.json
        - https://vahor.fr/invalid.json
        - https://vahor.fr/this/also/fails

sitemap.xml (1 broken links)
        - https://vahor.fr/this/should/fail

Options

  • --config <path> - Path to your next.config.js file.
    • If not set, it will try to find a next.config.js (mjs, cjs, ts or js) file in the current directory.
  • --domain <domain> - Domain to check links against.
    • If not set, non relative links will be ignored.
  • --verbose - Enable verbose mode.
  • --output <type> - Output type: 'export' for static export, undefined for standard build.
    • Only used when --no-config is specified.
  • --distDir <path> - Custom dist directory path.
    • Only used when --no-config is specified.
  • --no-config - Skip parsing next.config file and use provided options.
    • Useful to avoid installing dependencies present in next.config.js (e.g., contentlayer).
  • --ignore <pattern> - Ignore links matching the given pattern.
    • Can be used multiple times. Example: --ignore "**/*.zip" --ignore "**/*.json" to ignore links ending with .zip or .json.

Example

# For static export without parsing config
bunx @vahor/next-broken-links --no-config --output export

# For standard build with custom dist directory
bunx @vahor/next-broken-links --no-config --distDir custom-dist

# For static export with custom dist directory
bunx @vahor/next-broken-links --no-config --output export --distDir custom-out

Who is using this?