0.1.5 • Published 4 months ago
plugin-hono-ssr v0.1.5
Hono SSR Plugin for RSBuild
A plugin that integrates Hono SSR with RSBuild's development server.
Features
- Seamless integration between Hono and RSBuild
- Support for React Server-Side Rendering with streaming
- Hot Module Replacement for both client and server components
- Automatically handles manifest file for asset loading
Installation
npm install plugin-hono-ssr
# or
yarn add plugin-hono-ssr
# or
pnpm add plugin-hono-ssr
Usage
Add the plugin to your rsbuild.config.ts
:
import { defineConfig } from "@rsbuild/core";
import { pluginReact } from "@rsbuild/plugin-react";
import { pluginHonoSSR } from "plugin-hono-ssr";
export default defineConfig({
plugins: [
pluginReact(),
pluginHonoSSR({
// Optional: customize the path to your server entry
serverEntry: "dist/server/index.js",
// Optional: customize the path to your manifest file
manifestPath: "dist/manifest.json"
})
],
// ... rest of your config
});
Make sure you have a server entry file that exports a render
function:
// src/index.server.tsx
import React from 'react';
import App from './App';
export function render(context: any) {
return <App {...context} />;
}
Configuration Options
Option | Type | Default | Description |
---|---|---|---|
serverEntry | string | "dist/server/index.js" | Path to server entry point relative to project root |
manifestPath | string | "dist/manifest.json" | Path to manifest file relative to project root |
Development
Building locally
cd hono-plugin-rsbuild
npm install
npm run build
Publishing
To publish to npm:
npm login
npm publish
License
MIT