-
Notifications
You must be signed in to change notification settings - Fork 335
WIP: feat: add migrating to v2 solid-start guide #1378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,6 @@ | |
| "nesting.mdx", | ||
| "layouts.mdx", | ||
| "alternative-routers.mdx", | ||
| "queries.mdx", | ||
| "actions.mdx" | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,108 @@ | ||||||||||||||
| --- | ||||||||||||||
| title: Migrating from v1 | ||||||||||||||
| use_cases: >- | ||||||||||||||
| existing project, migration, upgrade | ||||||||||||||
| tags: | ||||||||||||||
| - setup | ||||||||||||||
| - installation | ||||||||||||||
| - starter | ||||||||||||||
| - template | ||||||||||||||
| - quickstart | ||||||||||||||
| - init | ||||||||||||||
| 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. | ||||||||||||||
|
|
||||||||||||||
| ## Migration steps | ||||||||||||||
|
|
||||||||||||||
| **1. Update your project to use the latest version of SolidStart** | ||||||||||||||
|
|
||||||||||||||
| ```package-install | ||||||||||||||
| @solidjs/start@alpha | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| **2. Rename `app.config.ts` to `vite.config.ts`** | ||||||||||||||
|
|
||||||||||||||
| **3. Update`vite.config.ts`** | ||||||||||||||
|
|
||||||||||||||
| v2 ships as a native vite plugin using the environment api instead of vinxi. | ||||||||||||||
|
|
||||||||||||||
| ```tsx | ||||||||||||||
| import { defineConfig } from "vite"; | ||||||||||||||
| import { solidStart } from "@solidjs/start/config"; | ||||||||||||||
| export default defineConfig({ | ||||||||||||||
| plugins: [ | ||||||||||||||
| solidStart(), | ||||||||||||||
| ] | ||||||||||||||
| }); | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| An important note is that `defineConfig` comes from `vite` directly. | ||||||||||||||
|
|
||||||||||||||
| #### Defining middleware | ||||||||||||||
|
|
||||||||||||||
| Middlware is defined using the `middleware` option on the `solidStart` vite plugin. | ||||||||||||||
|
|
||||||||||||||
| ```tsx | ||||||||||||||
| import { defineConfig } from "vite"; | ||||||||||||||
| import { solidStart } from "@solidjs/start/config"; | ||||||||||||||
| export default defineConfig({ | ||||||||||||||
|
Comment on lines
+53
to
+54
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
| plugins: [ | ||||||||||||||
| solidStart({ | ||||||||||||||
| middleware: "./src/middleware.ts" | ||||||||||||||
| }), | ||||||||||||||
| ] | ||||||||||||||
| }); | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| **4. Remove the vinxi dependency and add the vite dependency** | ||||||||||||||
|
|
||||||||||||||
| ```bash | ||||||||||||||
| pnpm remove vinxi | ||||||||||||||
| ``` | ||||||||||||||
|
Comment on lines
+65
to
+67
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
In order for this to work you also need to define the |
||||||||||||||
|
|
||||||||||||||
| ```json | ||||||||||||||
| "dependencies": { | ||||||||||||||
| "vite": "^7" | ||||||||||||||
| } | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| **5. Update`package.json` build/dev commands** | ||||||||||||||
|
|
||||||||||||||
| Update the build/dev commands to use native vite instead of vinxi. | ||||||||||||||
|
|
||||||||||||||
| ```json | ||||||||||||||
| "scripts": { | ||||||||||||||
| "dev": "vite dev", | ||||||||||||||
| "build": "vite build" | ||||||||||||||
| } | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| **6. Replace all leftover vinxi imports** | ||||||||||||||
|
|
||||||||||||||
| - `useSession` now comes from `@solidjs/start/server` instead of `vinxi/http | ||||||||||||||
|
Comment on lines
+86
to
+88
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It seems that nearly all exports from |
||||||||||||||
|
|
||||||||||||||
| **7. Add back nitro via the vite plugin** | ||||||||||||||
|
|
||||||||||||||
| ```package-install | ||||||||||||||
| nitro@latest | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| ```tsx | ||||||||||||||
| import { defineConfig } from "vite"; | ||||||||||||||
| import { solidStart } from "@solidjs/start/config"; | ||||||||||||||
|
|
||||||||||||||
| export default defineConfig({ | ||||||||||||||
| plugins: [ | ||||||||||||||
| solidStart(), | ||||||||||||||
| nitro({ | ||||||||||||||
| preset: 'netlify' | ||||||||||||||
| }) | ||||||||||||||
| ] | ||||||||||||||
| }); | ||||||||||||||
| ``` | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.