elysia-vite-plugin-ssr
v0.0.8
Published
Use [vite-plugin-ssr](https://vite-plugin-ssr.com/) with [Elysia](https://elysiajs.com/).
Downloads
18
Readme
elysia-vite-plugin-ssr
Use vite-plugin-ssr with Elysia.
1. Install
bun add elysia-vite-plugin-ssr
2. Usage
2.1. Prepare src/pages
& src/renderer
directory for vite-plugin-ssr. src
can be changed at will.
Please follow vite-plugin-ssr guide for detailed instruction & example.
2.2. Use elysiaVitePluginSsr
plugins.
// src/index.ts
import {Elysia} from 'elysia';
import {elysiaVitePluginSsr} from 'elysia-vite-plugin-ssr';
const app = new Elysia()
.use(elysiaVitePluginSsr({
pluginSsr: { // <-- must exist to trigger vite-plugin-ssr
// ... vite-plugin-ssr options
// baseAssets: 'https://cdn.example.com/assets/'
},
// onPluginSsrReady() {
// console.log("vite middleware is ready")
// },
// ... optional other vite config
base: "/ssr", // no trailing slash
root: path.resolve(import.meta.dir, "./"), // directories `./pages`, `./renderer` should exists
}));