Start: SSR dehydrated script output contains unnecessary whitespace/newlines
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
Which project does this relate to?
Start
Describe the bug
The inline <script> blocks generated by TanStack Start for SSR dehydration contain unnecessary blank lines and whitespace. Since this output is machine-generated serialization (Seroval streams, router state, etc.) and not user content, it could be minified without any risk of breaking functionality.
Your Example Website or App
https://github.com/canmi21/taki
Steps to Reproduce the Bug or Issue
View the HTML source of any SSR-rendered TanStack Start page. The dehydrated <script> tags contain patterns like:
<script>($R=>{ ... })($R["tsr"]);
document.currentScript.remove()</script>
There are blank lines between statements and unnecessary newlines within the Seroval stream constructor output.
Expected behavior
Dehydrated script output should be compact, e.g:
<script>($R=>{ ... })($R["tsr"]);document.currentScript.remove()</script>
Screenshots or Videos
Platform
- Router / Start Version: 1.166.11
- OS: any
- Browser: any
- Browser Version: any
- Bundler: vite
- Bundler Version: 8.0.0
Additional context
Why this matters
Slightly increases HTML payload size on every SSR response before compression Makes View Source unnecessarily noisy
This is framework-generated serialization, not user-authored content there is no "<pre.>" or whitespace-sensitive context to worry about, so it is safe to strip
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue in an SSR-rendered TanStack Start page and inspect the inline dehydrated <script> blocks in the HTML source. Trace the Seroval stream and router-state output responsible for the blank lines, then verify that the generated script is compact while SSR hydration still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- full-stack, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100