| title | Migrating from v1 | ||||||
|---|---|---|---|---|---|---|---|
| use_cases | existing project, migration, upgrade | ||||||
| tags |
|
||||||
| version | 2.0 | ||||||
| description | Migrate your SolidStart project from v1 to v2. |
This is a migration guide of how to upgrade your v1 SolidStart app to our new v2 version.
Please note that some third-party packages may not be compatible with v2 yet.
@solidjs/start@alpha.2 @solidjs/vite-plugin-nitro-2 vite@7
vinxi
- Remove
app.config.ts - Create
vite.config.ts
import { solidStart } from "@solidjs/start/config";
import { defineConfig } from "vite";
import { nitroV2Plugin } from "@solidjs/vite-plugin-nitro-2";
export default defineConfig(() => {
return {
plugins: [
solidStart({
middleware: "./src/middleware/index.ts",
}),
nitroV2Plugin(),
],
};
});Compile-time environment variables are now handled by Vite's environment API.
// ...
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
return {
// ...
environments: {
ssr: {
define: {
"process.env.DATABASE_URL": JSON.stringify(env.DATABASE_URL),
},
},
},
};
});Update the build/dev commands to use native Vite instead of vinxi.
"scripts": {
"dev": "vite dev",
"build": "vite build",
"start": "vite preview"
}Only the types entry is new in v2. Everything else can remain unchanged.
"compilerOptions": {
"types": ["@solidjs/start/env"]
}- Replace all imports from
vinxi/httpwith@solidjs/start/http - Optional: update the middleware syntax to the newer H3 syntax