fix(deploy): stop Nitro from publishing the Vite SPA index.html - #1716
Closed
gregnazario wants to merge 2 commits into
Closed
fix(deploy): stop Nitro from publishing the Vite SPA index.html#1716gregnazario wants to merge 2 commits into
gregnazario wants to merge 2 commits into
Conversation
Nitro defaults the client rollup input to renderer.template (index.html). With appType custom that file is copied into .vercel/output/static untransformed, so Vercel filesystem handling serves /app/client.tsx and browsers reject the HTML MIME type. Point the client build at app/client.tsx, strip leftover SPA shells, and register the PWA service worker from the hashed client bundle. Co-authored-by: greg <greg@gnazar.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
👷 Deploy Preview for aptos-explorer processing.
|
Bundle ReportChanges will increase total bundle size by 8.19MB (95.28%) ⬆️
Affected Assets, Files, and Routes:view changes for bundle: aptos-explorer-client-esmAssets Changed:
Files in
view changes for bundle: aptos-explorer-server-esmAssets Changed:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1716 +/- ##
==========================================
+ Coverage 36.39% 36.63% +0.24%
==========================================
Files 204 205 +1
Lines 9692 9729 +37
Branches 3798 3786 -12
==========================================
+ Hits 3527 3564 +37
Misses 6149 6149
Partials 16 16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
index.html was still Nitro's catch-all renderer-template, so /__server returned the Vite SPA shell even after stripping static index.html.
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.
The previous Vercel MIME-type fix (
framework: tanstack-start) still left production serving the Vite dev shell. After that deploy,https://explorer-aptoslabs.vercel.app/logged:Line 135 is the
<script type="module" src="/app/client.tsx">tag in repoindex.html(including the comment from the first fix).SW registered:comes from that same shell, not from TanStack Start SSR.Root cause
Nitro treats root
index.htmlasrenderer.templatewhenever that file exists:appType: "custom"it was copied into.vercel/output/staticuntransformed. Vercel’s{ handle: "filesystem" }then served it for/.ssr-renderer. The/__servercatch-all wasrenderer-template, which returns the same SPA HTML. Even after deleting the static file,/would still load/app/client.tsx.A local
VERCEL=1 pnpm buildafter this change confirms:.vercel/output/static/index.html/__serveruses_chunks/ssr-renderer.mjs→_ssr/ssr.mjs(createStartHandler, markdown negotiation)/assets/client-*.jsis emitted/app/client.tsxin the function bundleFix
app/client.tsx.renderer: falseso Start SSR is the catch-all (notrenderer-template).index.html/.gz/.brfromdist,.output/public, and.vercel/output/static.index.htmlinto the hashed client bundle.Operator note
In the Vercel project, Framework Preset must be TanStack Start and Output Directory must be empty (not
dist).vercel.jsonstill does not setoutputDirectory; a dashboard leftover ofdistrepublishes a static Vite tree and drops the Nitro server function.No Vercel Edge Functions / Edge Middleware. SSR remains Nitro on Vercel Node serverless.