Repository navigation
fix(deploy): upload dist/client for a Vite app built with void - #907
Merged
Merged
Conversation
A Vite app that depends on `void` builds with voidPlugin(), which writes browser files to dist/client and the server bundle, its source map and wrangler.json to dist/ssr. With no backend files, detectPreset step 4 picked `dist` as the static output, so `void deploy` published the server files and `/` returned 404 (index.html sat at /client/index.html). Pick dist/client in that case. A plain Vite app keeps `dist`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 154d3ca016
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://fix-static-void-app-deploy-void-cloud.voidzero-docs.workers.dev (commit ff6c9bb)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
…in() A project can install void for its CLI alone and keep Vite's plain dist output. Choosing dist/client from the dependency made those deploys fail with a missing output directory. Read the Vite config and use dist/client only when it imports voidPlugin from void. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eploy # Conflicts: # packages/void/src/cli/preset.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
How this was found
We tested the security-audits work (PR #886) end to end on a live self-hosted Void platform. One test app was a Vite app that uses
voidPlugin()and has no backend. Deploying it broke the site and made server files public. The bug is not part of the security-audits feature, and the same code is onmain, so it gets its own PR.Repro
package.jsonhasvite-plusandvoid.vite.config.tsusesplugins: [voidPlugin()].index.htmlandmain.js. Noroutes/,pages/, or other backend folders.void deployto a Void platform. The CLI prints "Static SPA deploy"./index.html/client/index.html/ssr/index.js.mapsourcesContent)/ssr/wrangler.jsonUploaded files on main:
client/index.html,client/assets/*,client/.vite/manifest.json,ssr/index.js,ssr/index.js.map,ssr/wrangler.json,ssr/.vite/manifest.json.Side effect: the server bundle has a new random build key on every build (
packages/void/src/router/compile.ts:881-883), so a redeploy of unchanged code uploaded a changedssr/index.js.mapand made a new deployment (and, with security audits on, a new scan) each time.Root cause
packages/void/src/cli/preset.ts:277-285(step 4) always useddist. That is right for plain Vite, which writesdist/index.html. ButvoidPlugin()splits the build:So the whole
dist/went up, and/had noindex.html.The same step is used by the managed platform path (
cli/deploy.ts), the native Cloudflare static path (resolveCloudflareStaticPresetincli/deploy-cloudflare-static.ts), and by configuredinference.appType: "spa" | "static"withoutoutputDir(resolveStaticDeployPresetincli/deploy-helpers.ts). All three get the fix.Fix
In step 4, when the package depends on
void, usedist/client. Plain Vite apps keepdist.void initaddsvoidPlugin()to Vite apps, so avoiddependency means the build has the split layout. App type staysspa, same as before; only the folder changes.The docs for
inference.outputDirnow say the default isdist/clientfor projects that depend onvoid.Tests
packages/void/test/unit/preset.test.tsuploads only dist/client for a Vite app built with void and no backend: vite-plus + void, onlyindex.html+main.js->dist/client,spa.uses dist/client for a configured static app built with void:inference.appType: "spa"with nooutputDir->dist/client.dist) and pass with the fix. The plain Vite and Vite+ tests still expectdist.vp run test: all groups pass except one timeout inplatform/packages/api/test/integration/admin-dashboard.test.ts("keeps runtime-log client fields when navigating away and back", 5 s, dashboard UI, not touched here). It passes when run alone.vp fmt --check,vp lint, and thevoidpackage typecheck pass. In a fresh worktree,vp checkalso reports missingplayground/*/.void/tsconfig.jsonfiles, which are generated by a playground build and are unrelated.🤖 Generated with Claude Code