Skip to content

Conversation

@JacobNWolf
Copy link

@JacobNWolf JacobNWolf commented Sep 27, 2025

Reference: honojs/vite-plugins#274

This PR attempts to address the way Hono adds new routes, which prevents proper HMR from working with toolkits like Vite. This PR introduces a new method for each router — clear — which will properly tear down the router while its running and adds a new rebuildRouter method, which will rebuild the router.

This allows for a more intelligent smart diff comparison, rather than what happened with the previous HMR attempt, which caused issues because of how Hono attempts to add new routes and breaking because the route already exists.

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

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