Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timnghg/elysia-vite-plugin-ssr
https://github.com/timnghg/elysia-vite-plugin-ssr
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/timnghg/elysia-vite-plugin-ssr
- Owner: timnghg
- Created: 2023-07-31T14:40:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-21T02:03:08.000Z (over 1 year ago)
- Last Synced: 2024-08-03T22:01:58.063Z (6 months ago)
- Language: TypeScript
- Size: 37.1 KB
- Stars: 9
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-elysia - Vite Plugin SSR - Vite Plugin SSR. (Plugins)
README
# elysia-vite-plugin-ssr ![Test](https://github.com/timnghg/elysia-vite-plugin-ssr/actions/workflows/main.yml/badge.svg)
Use [vite-plugin-ssr](https://vite-plugin-ssr.com/) with [Elysia](https://elysiajs.com/).
## 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](https://vite-plugin-ssr.com/add) for detailed instruction & example.2.2. Use `elysiaVitePluginSsr` plugins.
```js
// 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
}));
```