Skip to content

Commit 971b599

Browse files
committed
feat: add migrating to v2 solid-start guide
1 parent 833eff7 commit 971b599

3 files changed

Lines changed: 109 additions & 1 deletion

File tree

src/routes/solid-router/concepts/data.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"nesting.mdx",
99
"layouts.mdx",
1010
"alternative-routers.mdx",
11-
"queries.mdx",
1211
"actions.mdx"
1312
]
1413
}

src/routes/solid-start/data.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"pages": [
44
"index.mdx",
55
"getting-started.mdx",
6+
"migrating-from-v1.mdx",
67
"building-your-application",
78
"advanced",
89
"guides"
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
title: Migrating from v1
3+
use_cases: >-
4+
existing project, migration, upgrade
5+
tags:
6+
- setup
7+
- installation
8+
- starter
9+
- template
10+
- quickstart
11+
- init
12+
version: '2.0'
13+
description: >-
14+
Migrate your SolidStart project from v1 to v2.
15+
---
16+
17+
This is a migration guide of how to upgrade your v1 SolidStart app to our new v2 version.
18+
19+
Please note that some third-party packages may not be compatible with v2 yet.
20+
21+
## Migration steps
22+
23+
**1. Update your project to use the latest version of SolidStart**
24+
25+
```package-install
26+
@solidjs/start@alpha
27+
```
28+
29+
**2. Rename `app.config.ts` to `vite.config.ts`**
30+
31+
**3. Update`vite.config.ts`**
32+
33+
v2 ships as a native vite plugin using the environment api instead of vinxi.
34+
35+
```tsx
36+
import { defineConfig } from "vite";
37+
import { solidStart } from "@solidjs/start/config";
38+
export default defineConfig({
39+
plugins: [
40+
solidStart(),
41+
]
42+
});
43+
```
44+
45+
An important note is that `defineConfig` comes from `vite` directly.
46+
47+
#### Defining middleware
48+
49+
Middlware is defined using the `middleware` option on the `solidStart` vite plugin.
50+
51+
```tsx
52+
import { defineConfig } from "vite";
53+
import { solidStart } from "@solidjs/start/config";
54+
export default defineConfig({
55+
plugins: [
56+
solidStart({
57+
middleware: "./src/middleware.ts"
58+
}),
59+
]
60+
});
61+
```
62+
63+
**4. Remove the vinxi dependency and add the vite dependency**
64+
65+
```bash
66+
pnpm remove vinxi
67+
```
68+
69+
```json
70+
"dependencies": {
71+
"vite": "^7"
72+
}
73+
```
74+
75+
**5. Update`package.json` build/dev commands**
76+
77+
Update the build/dev commands to use native vite instead of vinxi.
78+
79+
```json
80+
"scripts": {
81+
"dev": "vite dev",
82+
"build": "vite build"
83+
}
84+
```
85+
86+
**6. Replace all leftover vinxi imports**
87+
88+
- `useSession` now comes from `@solidjs/start/server` instead of `vinxi/http
89+
90+
**7. Add back nitro via the vite plugin**
91+
92+
```package-install
93+
nitro@latest
94+
```
95+
96+
```tsx
97+
import { defineConfig } from "vite";
98+
import { solidStart } from "@solidjs/start/config";
99+
100+
export default defineConfig({
101+
plugins: [
102+
solidStart(),
103+
nitro({
104+
preset: 'netlify'
105+
})
106+
]
107+
});
108+
```

0 commit comments

Comments
 (0)