add react ssr document (#470)

* add react ssr document

* fix typo

* remove plugin-react

* update the typo

* fixed the order

---------

Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
pull/474/head
New Bing 2024-04-23 16:49:13 +08:00 committed by GitHub
parent 7e5e3de28f
commit 173e4ef01c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 0 deletions

View File

@ -22,6 +22,28 @@ npm i -D @types/react @types/react-dom
}
```
If you are using Vite, add `ssr external` config to `vite.config.ts`:
```typescript
import build from '@hono/vite-cloudflare-pages'
import devServer from '@hono/vite-dev-server'
import adapter from '@hono/vite-dev-server/cloudflare'
import { defineConfig } from 'vite'
export default defineConfig({
ssr: {
external: ['react', 'react-dom'], // <== add
},
plugins: [
build(),
devServer({
adapter,
entry: 'src/index.tsx',
}),
],
})
```
## Usage
### Basic