0001: Keep @hono/vite-dev-server
Retain the official Hono x Vite dev integration because it has zero production cost.
Kept
Source: docs/decisions/0001
<h1>@hono/vite-dev-server Evaluation</h1>
<h2>Status: ✅ <strong>KEPT</strong> — Recommended retention</h2>
<h2>What It Is</h2>
<p>Official Hono × Vite development integration plugin. Provides:</p>
<ul><li><strong>Middleware Mode</strong>: Vite handles static assets; Hono handles API/SSR routes via Vite's <code>server.middlewareMode</code></li><li><strong>HMR (Hot Module Replacement)</strong>: Instant updates during development without full page reloads</li><li><strong>Entry Point Injection</strong>: Auto-injects client-side <code><script></code> for module reloading</li><li><strong>SSR Streaming</strong>: Streams SSR responses through Vite dev server</li></ul>
<h2>Current Usage</h2>
<pre><code>packages/less-core/src/index.ts → import honoDevServer from '@hono/vite-dev-server'
→ honoDevServer({ entry: VIRTUAL_ENTRY_ID, injectClientScript: true })
packages/less-core/vite.config.build.ts → external: ['@hono/vite-dev-server'] (dev-only!)</code></pre>
<h2>Why It Exists (Not Removed)</h2>
<h3>The Alternative: Manual Implementation</h3>
<p>To replace <code>@hono/vite-dev-server</code>, LessJS would need a custom Vite plugin that:</p>
<table><thead><tr><th>Feature</th><th>Lines of Code</th><th>Complexity</th><th>Maintenance Risk</th></tr></thead><tbody><tr><td>Middleware mode setup</td><td>~20</td><td>Medium</td><td>Vite API changes between versions</td></tr><tr><td>HMR client injection</td><td>~15</td><td>High</td><td>Must track Vite's HMR protocol changes</td></tr><tr><td>SSR transform pipeline</td><td>~30</td><td>Very High</td><td>Must handle ESM/CJS interop, source maps</td></tr><tr><td>Request forwarding (Vite→Hono)</td><td>~25</td><td>Medium</td><td>Edge cases with streaming, headers</td></tr><tr><td>Error overlay integration</td><td>~10</td><td>Low</td><td>Nice-to-have but expected</td></tr><tr><td><strong>Total</strong></td><td><strong>~100 lines</strong></td><td><strong>High</strong></td><td><strong>Ongoing</strong></td></tr></tbody></table>
<h3>Cost-Benefit Analysis</h3>
<table><thead><tr><th>Factor</th><th>Keep Plugin</th><th>Remove & Reimplement</th></tr></thead><tbody><tr><td>Bundle size impact</td><td><strong>0</strong> (dev-only)</td><td><strong>0</strong></td></tr><tr><td>Dependency count</td><td>+1 npm dep</td><td>-1 npm dep</td></tr><tr><td>Code to maintain</td><td>~5 lines (usage)</td><td>~100 lines (impl)</td></tr><tr><td>HMR reliability</td><td>Battle-tested (Hono team)</td><td>Custom = bugs</td></tr><tr><td>Vite version compat</td><td>Maintained by authors</td><td>We track breaking changes</td></tr><tr><td>DX quality</td><td>Excellent (instant reload)</td><td>Degraded or broken</td></tr><tr><td><strong>Verdict</strong></td><td><strong>✅ Win</strong></td><td><strong>❌ Lose</strong></td></tr></tbody></table>
<h2>Honest Counter-arguments (Why ANALYSIS Marked This P3)</h2>
<ol><li><strong>"One less dependency"</strong> — Valid concern, BUT this dep is:</li></ol>
<ul><li>Dev-only (zero production footprint)</li><li>From Hono's own org (not a random package)</li><li>Already a transitive dep of <code>hono</code> ecosystem users likely have</li></ul>
<ol><li><strong>"Locks us to Hono"</strong> — True, but LessJS _is_ a Hono framework.</li></ol>
<p>Replacing Hono would require rewriting everything regardless of this plugin.</p>
<ol><li><strong>"Could break on Vite major bumps"</strong> — True, but:</li></ol>
<ul><li>The Hono team maintains this plugin alongside their framework</li><li>Our alternative implementation would break just as often (or worse)</li></ul>
<h2>Production Footprint: Zero</h2>
<pre data-language="bash"><code># Build output analysis (vite.config.build.ts):
external: ['@hono/vite-dev-server'] # ← Never bundled into SSR/client chunks</code></pre>
<p>The plugin is only loaded when <code>vite dev</code> runs (command === 'serve'). In <code>vite build</code>, the import is tree-shaken and the package never touched.</p>
<h2>Conclusion</h2>
<blockquote><p><strong>Keep @hono/vite-dev-server.</strong> The tradeoff heavily favors retention:</p><p>zero production cost vs. ~100 lines of custom maintenance code,</p><p>battle-tested HMR vs. home-grown bugs, and official support vs.</p><p>tracking Vite internal APIs across versions.</p><p></p><p>If a future requirement forces removal (e.g., switching from Hono),</p><p>the replacement cost is well-documented above (~100 lines).</p></blockquote>
<hr>
<p>_Evaluated: 2026-04-28 | Version reviewed: @hono/vite-dev-server@^0.25.3_</p>