0.1.5 • Published 4 months ago

plugin-hono-ssr v0.1.5

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

Hono SSR Plugin for RSBuild

A plugin that integrates Hono SSR with RSBuild's development server.

NPM Version License: MIT

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

OptionTypeDefaultDescription
serverEntrystring"dist/server/index.js"Path to server entry point relative to project root
manifestPathstring"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

0.1.5

4 months ago

0.1.4

4 months ago

0.1.3

4 months ago

0.1.1

4 months ago

0.1.0

4 months ago