Skip to content

feat(solidjs-vite-plugin): follow Solid's SSR and client mode entry rules - #2148

Merged
webpro merged 26 commits into
webpro-nl:mainfrom
everton-dgn:feat/solid-vite-plugin-mode-rules
Oct 15, 2026
Merged

webpro merged 26 commits into
webpro-nl:mainfrom
everton-dgn:feat/solid-vite-plugin-mode-rules

Conversation

@everton-dgn

@everton-dgn everton-dgn commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #2144.

Solid picks between authored and generated entries per mode (resolveEntries in src/ssr/index.ts, linked in the plugin):

  • with ssr: true and both entry files present, by option or by convention, App and Document are not loaded
  • without ssr, src/entry-server.* and start.setup are ignored, and so is App when there is a client entry

The plugin kept all of them as entries, which hides an App.tsx or Document.tsx that nothing imports anymore after moving to authored entries. It now applies the same rules. Conventional entry files are detected with isFile. The mode is only decided from a literal ssr: with another expression, nothing is dropped. Options spread into the call are not followed.

One limit: with --cache, adding or removing the entry files is only picked up when vite.config.* changes, because the cached result belongs to the config file.

Mark the files @solidjs/vite-plugin loads in start mode as production
entries: src/entry-server.*, src/entry-client.*, src/App.*,
src/Document.*, env.{ts,js} and the module paths in the start options.

Resolve start entries from the Vite root, accounting for SSR and client
mode. Also include serverFunctions.configure with or without start.
Keep start mode conventions, literal start.* paths, serverFunctions.configure
and the Vite root for configs that import the plugin statically.

Lazily loaded plugins, ternary paths and the SSR and client mode rules move
to follow-up pull requests. The tests are now one table over smaller
fixtures without node_modules stubs.
@pkg-pr-new

pkg-pr-new Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: a9ecae1

…y-paths

# Conflicts:
#	packages/knip/fixtures/plugins/solidjs-vite-plugin-entries/vite.config.ts
#	packages/knip/src/plugins/solidjs-vite-plugin/resolveFromAST.ts
#	packages/knip/test/plugins/solidjs-vite-plugin.test.ts
…-plugin-mode-rules

# Conflicts:
#	packages/knip/fixtures/plugins/solidjs-vite-plugin-root/package.json
#	packages/knip/test/plugins/solidjs-vite-plugin.test.ts

@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.

No findings from my side: the mode rules match resolveEntries, including setup being ignored in client mode.

…gin-lazy-paths

# Conflicts:
#	packages/knip/fixtures/plugins/solidjs-vite-plugin-spa/vite.config.ts
#	packages/knip/fixtures/plugins/solidjs-vite-plugin/vite.config.ts
#	packages/knip/src/plugins/solidjs-vite-plugin/resolveFromAST.ts
#	packages/knip/test/plugins/solidjs-vite-plugin.test.ts
@everton-dgn
everton-dgn marked this pull request as ready for review October 14, 2026 22:53
@everton-dgn

Copy link
Copy Markdown
Contributor Author

Updated after #2147: merged main (resolving the conflicts with #2155) and dropped everything from #2147, including the spread check. Only direct calls to the statically imported plugin are read, and the mode is only decided from a literal ssr. The main fixture now covers SSR mode with entries set by option, and -root switches to client mode to cover conventional entry files found with isFile.

@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 for simplifying this. The mode rules look good. hasEntryFile does filesystem access, which we're trying to avoid.

@webpro
webpro merged commit d711231 into webpro-nl:main Oct 15, 2026
32 checks passed
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