@hono/vite-ssg
v0.3.0
Published
Vite plugin to generate a static site from your Hono application
Readme
@hono/vite-ssg
@hono/vite-ssg is a Vite plugin to generate a static site from your Hono application.
Usage
Installation
You can install vite and @hono/vite-ssg via npm.
npm i -D vite @hono/vite-ssgOr you can install them with Bun.
bun add vite @hono/vite-ssgSettings
Add "type": "module" to your package.json. Then, create vite.config.ts and edit it.
import { defineConfig } from 'vite'
import ssg from '@hono/vite-ssg'
export default defineConfig({
plugins: [ssg()],
})Build
Just run vite build.
npm exec vite buildOr
bunx --bun vite buildDeploy to Cloudflare Pages
Run the wrangler command.
wrangler pages deploy ./distOptions
The options are below.
type SSGOptions = {
entry?: string
/**
* Hono SSG plugins to use.
* These are not Vite plugins, but plugins for Hono's static site generation.
* @see https://hono.dev/docs/helpers/ssg#plugins
*/
plugins?: SSGPlugin[]
}Default values:
const defaultOptions = {
entry: './src/index.tsx',
plugins: [],
}Authors
- Yusuke Wada https://github.com/yusukebe
License
MIT
