Skip to content

v2.0.0

Compare
Choose a tag to compare
@rphlmr rphlmr released this 25 Nov 18:45
· 9 commits to main since this release
7a78e9c

What's Changed

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

Full Changelog: v1.2.0...v2.0.0