Skip to content

Strip did-you-mean suggestions from production client bundles - #221

Merged
JoviDeCroock merged 1 commit into
mainfrom
JoviDeCroock/prod-strip-name-suggestions
Jul 11, 2026
Merged

Strip did-you-mean suggestions from production client bundles#221
JoviDeCroock merged 1 commit into
mainfrom
JoviDeCroock/prod-strip-name-suggestions

Conversation

@JoviDeCroock

Copy link
Copy Markdown
Owner

Summary

  • The Levenshtein edit-distance implementation in name-suggestions.ts (~776 B raw) shipped in every production client bundle, reachable through unguarded error paths in resolveApp/buildHref. Identified in the 2026-07 client bundle size audit (finding 2).
  • The suggestion is now computed only when import.meta.env.DEV is not statically false, so production Vite builds constant-fold the ternary and dead-code-eliminate closestName/levenshteinDistance. Production errors still list all registered names; dev, vitest, and Node CLI builds keep the full "Did you mean" messages.
  • Measured on examples/basic: shared runtime chunk 8.97 → 8.41 kB raw (3.61 → 3.35 kB gzip).

Testing

  • pnpm e2e (80 passed)
  • pnpm format
  • pnpm lint (via pnpm exec oxlint, 0 errors)
  • pnpm test (605 passed)

Checklist

  • Docs updated if needed (N/A — internal error-message behavior, dev output unchanged)
  • Skills updated if needed (N/A)
  • Changeset added if published packages changed

🤖 Generated with Claude Code

The Levenshtein edit-distance implementation in name-suggestions.ts shipped
in every production client bundle via unguarded error paths in resolveApp
and buildHref. Compute the suggestion only when import.meta.env.DEV is not
statically false, so production Vite builds constant-fold the ternary and
dead-code-eliminate closestName and levenshteinDistance (~560 B raw,
~260 B gzip per app). Dev servers, vitest, and Node CLI builds keep the
full "Did you mean" messages.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@JoviDeCroock
JoviDeCroock merged commit b183114 into main Jul 11, 2026
3 checks passed
@JoviDeCroock
JoviDeCroock deleted the JoviDeCroock/prod-strip-name-suggestions branch July 11, 2026 11:47
@github-actions github-actions Bot mentioned this pull request Jul 11, 2026
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