knip icon indicating copy to clipboard operation
knip copied to clipboard

🐛 Dev dependencies are reported as unused

Open blake-newman opened this issue 1 year ago • 1 comments

Prerequisites

Reproduction url

Reproduction access

  • [X] I've made sure the reproduction is publicly accessible

Description of the issue

Currently dev dependencies are reported as unused if they are not included in any entry files.

However, commonly dev dependencies are used in none poduction code. I can't seem to find a way to tell knip that if it's used in a development file then it's okay.

Example configuration:

entry: ['src/index.{ts,tsx}!'],
project: [
  '**/*.{ts,tsx,vue}!',
  '!**/*.{bench,test,test-d}.{ts,tsx}!',
]

If a dev dependency is used in a test file it will still report as unused, the only way to resolve would be to include the test files as entry points. However; this is really slow (our monorepo won't run knip with that setting as it just hangs).

blake-newman avatar Sep 03 '24 10:09 blake-newman

A reproduction is required, not sure exactly what you're doing and what you're expecting.

Did you add the --production or --strict flag? In strict production mode it won't report dev dependencies.

our monorepo won't run knip with that setting as it just hangs

You could try --isolate-workspaces.

webpro avatar Sep 03 '24 10:09 webpro

Closing due to inactivity.

webpro avatar Oct 31 '24 12:10 webpro