Skip to content

Keep the vite-node entry after --watch and -w - #2450

Merged
webpro merged 8 commits into
webpro-nl:mainfrom
everton-dgn:fix/vite-node-watch-entry
Nov 22, 2026
Merged

webpro merged 8 commits into
webpro-nl:mainfrom
everton-dgn:fix/vite-node-watch-entry

Conversation

@everton-dgn

@everton-dgn everton-dgn commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

With vite-node --watch ./start.ts (graphql-starter-kit), Knip reports server/start.ts as an unused file, and the devDependencies it imports as unused. vite-node has no plugin, so the fallback takes the entry as the value of --watch or -w.

It now gets an args-only plugin with its boolean flags and positional: true, as in the ts-node-dev plugin. The first positional is the only file vite-node runs (source).

@pkg-pr-new

pkg-pr-new Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/knip@2450
npm i https://pkg.pr.new/@knip/language-server@2450
npm i https://pkg.pr.new/@knip/mcp@2450

commit: 0a27577

@webpro webpro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Éverton! The args-only plugin with vite-node's own boolean flags is the same shape as ts-node-dev, and with vite-node --watch ./start.ts the graphql-starter-kit server now credits start.ts and the devDependencies it imports.

#2444 has landed, so this is ready for the merge of main. That merge conflicts in fallback.ts and in the positionals test, and this branch's side is the one to keep in both.

…-entry

# Conflicts:
#	packages/knip/src/binaries/fallback.ts
#	packages/knip/test/util/get-inputs-from-scripts.test.ts
@everton-dgn
everton-dgn marked this pull request as ready for review November 21, 2026 16:12
@webpro
webpro merged commit 96bd856 into webpro-nl:main Nov 22, 2026
33 checks passed
@webpro

webpro commented Nov 22, 2026

Copy link
Copy Markdown
Member

🚀 This pull request is included in v6.48.0. See Release 6.48.0 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants