You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/vite-ssr-preact/GUIDE.md
+1-12Lines changed: 1 addition & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ Set up server-side rendering (SSR) with Preact, Vite, and Nitro. This setup enab
9
9
10
10
## 1. Configure Vite
11
11
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:
13
13
14
14
```js [vite.config.mjs]
15
15
import { defineConfig } from"vite";
@@ -18,20 +18,9 @@ import preact from "@preact/preset-vite";
18
18
19
19
exportdefaultdefineConfig({
20
20
plugins: [nitro(), preact()],
21
-
environments: {
22
-
client: {
23
-
build: {
24
-
rollupOptions: {
25
-
input:"./src/entry-client.tsx",
26
-
},
27
-
},
28
-
},
29
-
},
30
21
});
31
22
```
32
23
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
-
35
24
## 2. Create the App Component
36
25
37
26
Create a shared Preact component that runs on both server and client:
Copy file name to clipboardExpand all lines: examples/vite-ssr-preact/README.md
+2-22Lines changed: 2 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ icon: i-logos-preact
23
23
"@preact/preset-vite": "^2.10.3",
24
24
"@tailwindcss/vite": "^4.1.18",
25
25
"nitro": "latest",
26
-
"preact": "^10.28.2",
26
+
"preact": "^10.28.3",
27
27
"preact-render-to-string": "^6.6.5",
28
28
"tailwindcss": "^4.1.18",
29
29
"vite": "beta"
@@ -48,15 +48,6 @@ import preact from "@preact/preset-vite";
48
48
49
49
exportdefaultdefineConfig({
50
50
plugins: [nitro(), preact()],
51
-
environments: {
52
-
client: {
53
-
build: {
54
-
rollupOptions: {
55
-
input:"./src/entry-client.tsx",
56
-
},
57
-
},
58
-
},
59
-
},
60
51
});
61
52
```
62
53
@@ -151,7 +142,7 @@ Set up server-side rendering (SSR) with Preact, Vite, and Nitro. This setup enab
151
142
152
143
## 1. Configure Vite
153
144
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:
155
146
156
147
```js [vite.config.mjs]
157
148
import { defineConfig } from"vite";
@@ -160,20 +151,9 @@ import preact from "@preact/preset-vite";
160
151
161
152
exportdefaultdefineConfig({
162
153
plugins: [nitro(), preact()],
163
-
environments: {
164
-
client: {
165
-
build: {
166
-
rollupOptions: {
167
-
input:"./src/entry-client.tsx",
168
-
},
169
-
},
170
-
},
171
-
},
172
154
});
173
155
```
174
156
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
-
177
157
## 2. Create the App Component
178
158
179
159
Create a shared Preact component that runs on both server and client:
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
-
31
24
## 2. Create the App Component
32
25
33
26
Create a shared React component that runs on both server and client:
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
-
163
151
## 2. Create the App Component
164
152
165
153
Create a shared React component that runs on both server and client:
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.
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.
0 commit comments