Skip to content

fix: support relocated client-mode build outputs - #386

Closed
everton-dgn wants to merge 2 commits into
solidjs:nextfrom
everton-dgn:fix/client-nitro-prerender
Closed

everton-dgn wants to merge 2 commits into
solidjs:nextfrom
everton-dgn:fix/client-nitro-prerender

Conversation

@everton-dgn

@everton-dgn everton-dgn commented Sep 30, 2026 •

Copy link
Copy Markdown

Client-mode prerender imported dist/server/server.js and wrote the shell to dist/client, even when a host such as Nitro relocated both outputs. These builds failed with ERR_MODULE_NOT_FOUND; applications without server functions also discarded the service before the host could consume it.

Use the resolved and emitted environment directories for prerender and preview. Retain the SSR service for host build orchestrators, including applications without server functions. Standalone client builds keep their static-only output. Align the preview SSR default with build, and limit standalone cleanup to an SSR directory strictly inside the project root that cannot contain client output. Log a warning when an unsafe target prevents that cleanup.

Add real production-build/HTTP regression coverage for relocated outputs, explicit SSR output configuration and both client/SSR modes. Test unsafe cleanup targets by observing the existing hook without executing removal. Each test runs in its own fixture sandbox and sends its artifacts to the trash on success or failure, using a development-only dependency. The host proof closes its preview server in finally. Update the client-mode README and add a patch changeset.

Closes #381.

Validation:

  • Failure reproduced before the fix with both a miniature host and Nitro 3.0.260903-beta.
  • Six miniature/configured build-and-preview scenarios, including shell contents, hashed assets and HTTP server-function dispatch; seven cleanup-target cases covering warning and removal eligibility, with and without a host or server functions.
  • Actual Nitro production builds and preview passed with server functions enabled and disabled, plus SSR (node-server preset).
  • Injected setup, build and assertion failures in both test scripts passed their cleanup assertions. The preview closed on the assertion failure, no new sandbox remained and the existing shared fixture output was unchanged.
  • Test sandboxes and caches are isolated outside node_modules, so the fixture exercises the application's transform pipeline. An SSR metadata assertion fails when the former dependency-path sandbox is restored and passes in both miniature SSR modes and Nitro SSR.
  • Package build, TypeScript and package-check (100/100) passed after the follow-up. Test scripts and package metadata pass formatting.
  • Standalone client suite: 65/65; SSR preview: 37/37; base path: 20/20 on the original reviewed fix. External delegation (3/3) and authored entries (21/21) passed before its final review corrections.

The broader SSR suite ran on an earlier candidate with 583/586 passing; the failing preview/base modes passed after correction, and authored entries passed on an isolated repeat. The full broader suite was not repeated on the final candidate or this follow-up. Existing whole-file formatting differences remain outside this fix. Tests ran on Node 24.21.0; the cleanup dependency's Node >=20 requirement is compatible with the project's >=22.12.0 minimum. No other Nitro preset, Vite version or operating system was tested.

@changeset-bot

changeset-bot Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4dab536

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/vite-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedtrash@​10.1.1881009483100

View full report

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.

1 participant