Skip to content

Commit a93018e

Browse files
brenelzkodiakhq[bot]birkskyumamirhhashemiatilafassina
authored
feat: add migrating to v2 solid-start guide (#1378)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Birk Skyum <74932975+birkskyum@users.noreply.github.com> Co-authored-by: Amir Hossein Hashemi <87268103+amirhhashemi@users.noreply.github.com> Co-authored-by: Atila Fassina <atila@fassina.eu> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Derpius <49565664+Derpius@users.noreply.github.com>
1 parent 3bcdb38 commit a93018e

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed

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: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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+
### Update dependencies
24+
25+
```package-install
26+
@solidjs/start@2.0.0-alpha.2 @solidjs/vite-plugin-nitro-2 vite@7
27+
```
28+
29+
```package-remove
30+
vinxi
31+
```
32+
33+
### Configuration files
34+
35+
- Remove `app.config.ts`
36+
- Create `vite.config.ts`
37+
38+
```tsx title="vite.config.ts"
39+
import { solidStart } from "@solidjs/start/config";
40+
import { defineConfig } from "vite";
41+
import { nitroV2Plugin } from "@solidjs/vite-plugin-nitro-2";
42+
43+
export default defineConfig(() => {
44+
return {
45+
plugins: [
46+
solidStart({
47+
middleware: "./src/middleware/index.ts",
48+
}),
49+
nitroV2Plugin(),
50+
],
51+
};
52+
});
53+
```
54+
55+
Compile-time environment variables are now handled by Vite's environment API.
56+
57+
```tsx title="vite.config.ts"
58+
// ...
59+
export default defineConfig(({ mode }) => {
60+
const env = loadEnv(mode, process.cwd(), "");
61+
62+
return {
63+
// ...
64+
environments: {
65+
ssr: {
66+
define: {
67+
"process.env.DATABASE_URL": JSON.stringify(env.DATABASE_URL),
68+
},
69+
},
70+
},
71+
};
72+
});
73+
```
74+
75+
Update the build/dev commands to use native Vite instead of vinxi.
76+
77+
```json
78+
"scripts": {
79+
"dev": "vite dev",
80+
"build": "vite build",
81+
"start": "vite preview"
82+
}
83+
```
84+
85+
### Environment types
86+
87+
Only the `types` entry is new in v2. Everything else can remain unchanged.
88+
89+
```json
90+
"compilerOptions": {
91+
"types": ["@solidjs/start/env"]
92+
}
93+
```
94+
95+
## Server runtime helpers
96+
97+
- Replace all imports from `vinxi/http` with `@solidjs/start/http`
98+
- Optional: update the middleware syntax to the newer [H3 syntax](https://h3.dev/guide/basics/middleware)

0 commit comments

Comments
 (0)