Skip to content

Commit 3778307

Browse files
committed
docs: update ssr examples
1 parent 044ac5b commit 3778307

10 files changed

Lines changed: 416 additions & 106 deletions

File tree

examples/vite-ssr-preact/GUIDE.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Set up server-side rendering (SSR) with Preact, Vite, and Nitro. This setup enab
99

1010
## 1. Configure Vite
1111

12-
Add the Nitro and Preact plugins to your Vite config. Define the `client` environment with your client entry point:
12+
Add the Nitro and Preact plugins to your Vite config:
1313

1414
```js [vite.config.mjs]
1515
import { defineConfig } from "vite";
@@ -18,20 +18,9 @@ import preact from "@preact/preset-vite";
1818

1919
export default defineConfig({
2020
plugins: [nitro(), preact()],
21-
environments: {
22-
client: {
23-
build: {
24-
rollupOptions: {
25-
input: "./src/entry-client.tsx",
26-
},
27-
},
28-
},
29-
},
3021
});
3122
```
3223

33-
The `environments.client` configuration tells Vite which file to use as the browser entry point. Nitro automatically detects the server entry from files named `entry-server` or `server` in common directories.
34-
3524
## 2. Create the App Component
3625

3726
Create a shared Preact component that runs on both server and client:

examples/vite-ssr-preact/README.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ icon: i-logos-preact
2323
"@preact/preset-vite": "^2.10.3",
2424
"@tailwindcss/vite": "^4.1.18",
2525
"nitro": "latest",
26-
"preact": "^10.28.2",
26+
"preact": "^10.28.3",
2727
"preact-render-to-string": "^6.6.5",
2828
"tailwindcss": "^4.1.18",
2929
"vite": "beta"
@@ -48,15 +48,6 @@ import preact from "@preact/preset-vite";
4848

4949
export default defineConfig({
5050
plugins: [nitro(), preact()],
51-
environments: {
52-
client: {
53-
build: {
54-
rollupOptions: {
55-
input: "./src/entry-client.tsx",
56-
},
57-
},
58-
},
59-
},
6051
});
6152
```
6253

@@ -151,7 +142,7 @@ Set up server-side rendering (SSR) with Preact, Vite, and Nitro. This setup enab
151142

152143
## 1. Configure Vite
153144

154-
Add the Nitro and Preact plugins to your Vite config. Define the `client` environment with your client entry point:
145+
Add the Nitro and Preact plugins to your Vite config:
155146

156147
```js [vite.config.mjs]
157148
import { defineConfig } from "vite";
@@ -160,20 +151,9 @@ import preact from "@preact/preset-vite";
160151

161152
export default defineConfig({
162153
plugins: [nitro(), preact()],
163-
environments: {
164-
client: {
165-
build: {
166-
rollupOptions: {
167-
input: "./src/entry-client.tsx",
168-
},
169-
},
170-
},
171-
},
172154
});
173155
```
174156

175-
The `environments.client` configuration tells Vite which file to use as the browser entry point. Nitro automatically detects the server entry from files named `entry-server` or `server` in common directories.
176-
177157
## 2. Create the App Component
178158

179159
Create a shared Preact component that runs on both server and client:

examples/vite-ssr-react/GUIDE.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Set up server-side rendering (SSR) with React, Vite, and Nitro. This setup enabl
99

1010
## 1. Configure Vite
1111

12-
Add the Nitro and React plugins to your Vite config. Define the `client` environment with your client entry point:
12+
Add the Nitro and React plugins to your Vite config:
1313

1414
```js [vite.config.mjs]
1515
import { defineConfig } from "vite";
@@ -18,16 +18,9 @@ import react from "@vitejs/plugin-react";
1818

1919
export default defineConfig({
2020
plugins: [nitro(), react()],
21-
environments: {
22-
client: {
23-
build: { rollupOptions: { input: "./src/entry-client.tsx" } },
24-
},
25-
},
2621
});
2722
```
2823

29-
The `environments.client` configuration tells Vite which file to use as the browser entry point. Nitro automatically detects the server entry from files named `entry-server` or `server` in common directories.
30-
3124
## 2. Create the App Component
3225

3326
Create a shared React component that runs on both server and client:

examples/vite-ssr-react/README.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ icon: i-logos-react
2020
"dev": "vite dev"
2121
},
2222
"devDependencies": {
23-
"@types/react": "^19.2.10",
23+
"@types/react": "^19.2.13",
2424
"@types/react-dom": "^19.2.3",
25-
"@vitejs/plugin-react": "^5.1.2",
25+
"@vitejs/plugin-react": "^5.1.3",
2626
"nitro": "latest",
2727
"react": "^19.2.4",
2828
"react-dom": "^19.2.4",
@@ -49,11 +49,6 @@ import react from "@vitejs/plugin-react";
4949

5050
export default defineConfig({
5151
plugins: [nitro(), react()],
52-
environments: {
53-
client: {
54-
build: { rollupOptions: { input: "./src/entry-client.tsx" } },
55-
},
56-
},
5752
});
5853
```
5954

@@ -141,7 +136,7 @@ Set up server-side rendering (SSR) with React, Vite, and Nitro. This setup enabl
141136

142137
## 1. Configure Vite
143138

144-
Add the Nitro and React plugins to your Vite config. Define the `client` environment with your client entry point:
139+
Add the Nitro and React plugins to your Vite config:
145140

146141
```js [vite.config.mjs]
147142
import { defineConfig } from "vite";
@@ -150,16 +145,9 @@ import react from "@vitejs/plugin-react";
150145

151146
export default defineConfig({
152147
plugins: [nitro(), react()],
153-
environments: {
154-
client: {
155-
build: { rollupOptions: { input: "./src/entry-client.tsx" } },
156-
},
157-
},
158148
});
159149
```
160150

161-
The `environments.client` configuration tells Vite which file to use as the browser entry point. Nitro automatically detects the server entry from files named `entry-server` or `server` in common directories.
162-
163151
## 2. Create the App Component
164152

165153
Create a shared React component that runs on both server and client:

examples/vite-ssr-solid/GUIDE.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Set up server-side rendering (SSR) with SolidJS, Vite, and Nitro. This setup use
99

1010
## 1. Configure Vite
1111

12-
Add the Nitro and SolidJS plugins to your Vite config. SolidJS requires explicit JSX configuration and both `ssr` and `client` environments:
12+
Add the Nitro and SolidJS plugins to your Vite config:
1313

1414
```js [vite.config.mjs]
1515
import solid from "vite-plugin-solid";
@@ -19,18 +19,10 @@ import { nitro } from "nitro/vite";
1919
export default defineConfig({
2020
plugins: [solid({ ssr: true }), nitro()],
2121
esbuild: { jsx: "preserve", jsxImportSource: "solid-js" },
22-
environments: {
23-
ssr: {
24-
build: { rollupOptions: { input: "./src/entry-server.tsx" } },
25-
},
26-
client: {
27-
build: { rollupOptions: { input: "./src/entry-client.tsx" } },
28-
},
29-
},
3022
});
3123
```
3224

33-
Enable SSR mode in the Solid plugin with `solid({ ssr: true })`. Configure esbuild to preserve JSX for Solid's compiler and use Solid's JSX runtime. SolidJS requires explicit `ssr` and `client` environment configuration in Vite.
25+
Enable SSR mode in the Solid plugin with `solid({ ssr: true })`. Configure esbuild to preserve JSX for Solid's compiler and use Solid's JSX runtime.
3426

3527
## 2. Create the App Component
3628

examples/vite-ssr-solid/README.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ import { nitro } from "nitro/vite";
4545
export default defineConfig({
4646
plugins: [solid({ ssr: true }), nitro()],
4747
esbuild: { jsx: "preserve", jsxImportSource: "solid-js" },
48-
environments: {
49-
ssr: {
50-
build: { rollupOptions: { input: "./src/entry-server.tsx" } },
51-
},
52-
client: {
53-
build: { rollupOptions: { input: "./src/entry-client.tsx" } },
54-
},
55-
},
5648
});
5749
```
5850

@@ -158,7 +150,7 @@ Set up server-side rendering (SSR) with SolidJS, Vite, and Nitro. This setup use
158150

159151
## 1. Configure Vite
160152

161-
Add the Nitro and SolidJS plugins to your Vite config. SolidJS requires explicit JSX configuration and both `ssr` and `client` environments:
153+
Add the Nitro and SolidJS plugins to your Vite config:
162154

163155
```js [vite.config.mjs]
164156
import solid from "vite-plugin-solid";
@@ -168,18 +160,10 @@ import { nitro } from "nitro/vite";
168160
export default defineConfig({
169161
plugins: [solid({ ssr: true }), nitro()],
170162
esbuild: { jsx: "preserve", jsxImportSource: "solid-js" },
171-
environments: {
172-
ssr: {
173-
build: { rollupOptions: { input: "./src/entry-server.tsx" } },
174-
},
175-
client: {
176-
build: { rollupOptions: { input: "./src/entry-client.tsx" } },
177-
},
178-
},
179163
});
180164
```
181165

182-
Enable SSR mode in the Solid plugin with `solid({ ssr: true })`. Configure esbuild to preserve JSX for Solid's compiler and use Solid's JSX runtime. SolidJS requires explicit `ssr` and `client` environment configuration in Vite.
166+
Enable SSR mode in the Solid plugin with `solid({ ssr: true })`. Configure esbuild to preserve JSX for Solid's compiler and use Solid's JSX runtime.
183167

184168
## 2. Create the App Component
185169

examples/vite-ssr-tsr-react/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ icon: i-simple-icons-tanstack
3636
"preview": "vite preview"
3737
},
3838
"devDependencies": {
39-
"@tanstack/react-router": "^1.157.16",
40-
"@tanstack/react-router-devtools": "^1.157.16",
41-
"@tanstack/router-plugin": "^1.157.16",
42-
"@types/react": "^19.2.10",
39+
"@tanstack/react-router": "^1.158.1",
40+
"@tanstack/react-router-devtools": "^1.158.1",
41+
"@tanstack/router-plugin": "^1.158.1",
42+
"@types/react": "^19.2.13",
4343
"@types/react-dom": "^19.2.3",
44-
"@vitejs/plugin-react": "^5.1.2",
44+
"@vitejs/plugin-react": "^5.1.3",
4545
"nitro": "latest",
4646
"react": "^19.2.4",
4747
"react-dom": "^19.2.4",

0 commit comments

Comments
 (0)