v2.0.0
What's Changed
- Support for react-router v7 by @AlemTuzlak in #10
- V2 - React Router v7 by @rphlmr in #18
Important
This new version is only compatible with React Router v7
You can still use the v1 with @remix-run. Previous docs
Migration guide from v1 here
It's now a Vite Plugin 🥳
Install the following npm package.
npm install react-router-hono-server@latest
Easy mode
In your vite.config.ts
, add the reactRouterHonoServer
plugin.
import { reactRouter } from "@react-router/dev/vite";
import { reactRouterHonoServer } from "react-router-hono-server/dev"; // add this
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig({
plugins: [
reactRouterHonoServer(), // add this
reactRouter(),
tsconfigPaths()
],
});
That's all!
How it works
This helper works differently depending on the environment.
In development, it uses @hono/vite-dev-server and loads your server and React Router app with import('virtual:react-router/server-build')
.
It can be configured in vite.config.ts
.
When building for production, the Hono server is compiled as build/server/index.js
and imports your React Router app from assets/server-build-[hash].js
.
New Contributors
- @AlemTuzlak made their first contribution in #10
Full Changelog: v1.2.0...v2.0.0