Migrating from v1

Edit this page

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.


Migration steps

Update dependencies

Configuration files

  • 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"
}

Environment types

Only the types entry is new in v2. Everything else can remain unchanged.

"compilerOptions": {
"types": ["@solidjs/start/env"]
}

Server runtime helpers

  • Replace all imports from vinxi/http with @solidjs/start/http
  • Optional: update the middleware syntax to the newer H3 syntax
Report an issue with this page