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

@berenddeboer/nx-knip

v1.1.0

Published

Nx self-inferring plugin for Knip - find unused dependencies, exports, and files

Readme

@berenddeboer/nx-knip

A self-inferring Nx plugin for Knip - find unused dependencies, exports, and files in your JavaScript/TypeScript projects.

Install

Install both the plugin and knip:

npm install --save-dev @berenddeboer/nx-knip knip
pnpm add --save-dev @berenddeboer/nx-knip knip
yarn add --dev @berenddeboer/nx-knip knip
bun add -D @berenddeboer/nx-knip knip

Usage

Plugin Setup

Add the plugin to your nx.json:

{
  "plugins": [
    {
      "plugin": "@berenddeboer/nx-knip",
      "options": {
        "targetName": "knip"
      }
    }
  ]
}

This will automatically add a knip target to all projects in your workspace.

Running Knip

Run knip for a single project:

nx knip my-project

Run knip for all affected projects:

nx affected -t knip

Or run it for all projects:

nx run-many -t knip

Executor Options

strict

Enable strict mode (implies --production). Defaults to false. When enabled, knip will:

  • Verify isolation: workspaces should use strictly their own dependencies
  • Include peerDependencies when finding unused or unlisted dependencies
  • Report type-only imports listed in dependencies

You can enable it for all projects via the plugin options in nx.json:

{
  "plugins": [
    {
      "plugin": "@berenddeboer/nx-knip",
      "options": {
        "targetName": "knip",
        "strict": true
      }
    }
  ]
}

Or per-project in project.json:

{
  "targets": {
    "knip": {
      "options": {
        "strict": true
      }
    }
  }
}

env

Set environment variables for the knip process. This is useful when knip loads .ts files that throw on missing environment variables - you can provide dummy values so knip can analyze the files without errors.

Configure via targetDefaults in nx.json:

{
  "targetDefaults": {
    "knip": {
      "options": {
        "env": {
          "SQLITE_DATABASE_PATH": "/tmp/knip-dummy.db",
          "PF_ORG": "examples/demo"
        }
      }
    }
  }
}

Or per-project in project.json:

{
  "targets": {
    "knip": {
      "options": {
        "env": {
          "DATABASE_URL": "postgres://localhost/dummy"
        }
      }
    }
  }
}

The provided environment variables are merged with the current process.env, so existing variables are preserved and the specified ones are added or overridden.

How it works

This plugin runs knip --workspace {projectRoot} from the workspace root for each project. This means:

  1. It uses the --workspace flag to focus on a specific workspace
  2. The workspace root knip.json configuration is used
  3. If Bun is installed, the plugin automatically uses knip-bun for significantly better performance

Learn More