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
parent
7e5e3de28f
commit
173e4ef01c
|
@ -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
|
## Usage
|
||||||
|
|
||||||
### Basic
|
### Basic
|
||||||
|
|
Loading…
Reference in New Issue