Skip to content

Pass isSsrBuild to Vite config functions - #2191

Merged
webpro merged 1 commit into
webpro-nl:mainfrom
mkantautas:fix/vite-is-ssr-build
Oct 22, 2026
Merged

webpro merged 1 commit into
webpro-nl:mainfrom
mkantautas:fix/vite-is-ssr-build

Conversation

@mkantautas

Copy link
Copy Markdown
Contributor

Vite 5 renamed the SSR flag it passes to a config function: Vite 4 calls it with { command, mode, ssrBuild }, Vite 5+ with { command, mode, isSsrBuild, isPreview }. Knip only passed ssrBuild, so with build: { rollupOptions: { input: isSsrBuild ? './server/app.ts' : undefined } } the SSR entry and everything it imports are reported as unused files.

Knip now passes isSsrBuild along with ssrBuild, so configs written for either version see the SSR build.

Extended the vite plugin fixture with an SSR-only input. On main the test fails with server/app.ts in unused files; it passes now. The vitest-regression fixture still covers ssrBuild. The full test suite and pnpm run ci pass.

@pkg-pr-new

pkg-pr-new Bot commented Oct 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: c9e852f

@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, Mantas! Good catch on the Vite 5 rename, and keeping ssrBuild keeps Vite 4 configs working.

@webpro
webpro merged commit d2aa101 into webpro-nl:main Oct 22, 2026
32 checks passed
@webpro

webpro commented Oct 24, 2026

Copy link
Copy Markdown
Member

πŸš€ This pull request is included in v6.43.0. See Release 6.43.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