-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
docs(solid-start): nitro vite plugin example #5577
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
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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| node_modules | ||
| .DS_Store | ||
| .cache | ||
| .env | ||
| dist | ||
| .wrangler | ||
|
|
||
| # Local Netlify folder | ||
| .netlify | ||
| .nitro |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| **/public | ||
| pnpm-lock.yaml | ||
| routeTree.gen.ts | ||
| worker-configuration.d.ts |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "files.watcherExclude": { | ||
| "**/routeTree.gen.ts": true | ||
| }, | ||
| "search.exclude": { | ||
| "**/routeTree.gen.ts": true | ||
| }, | ||
| "files.readonlyInclude": { | ||
| "**/routeTree.gen.ts": true | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Start Basic Netlify | ||
|
|
||
| ## Getting Started | ||
|
|
||
| ### Install the dependencies | ||
|
|
||
| ```bash | ||
| pnpm i | ||
| ``` | ||
|
|
||
| ### Start the development server | ||
|
|
||
| ```bash | ||
| pnpm dev | ||
| ``` | ||
|
|
||
| ### Build for Production | ||
|
|
||
| ```bash | ||
| pnpm build | ||
| ``` | ||
|
|
||
| ### Deploy to Netlify | ||
|
|
||
| ```sh | ||
| netlify deploy | ||
| ``` | ||
|
|
||
| ## Accessing bindings | ||
|
|
||
| You can access Cloudflare bindings in server functions by using importable `env`: | ||
|
|
||
| ```ts | ||
| import { env } from 'cloudflare:workers' | ||
| ``` | ||
|
|
||
| See `src/routes/index.tsx` for an example. | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "name": "tanstack-solid-start-example-basic-nitro", | ||||||||||||||||||||||||||
| "private": true, | ||||||||||||||||||||||||||
| "sideEffects": false, | ||||||||||||||||||||||||||
| "type": "module", | ||||||||||||||||||||||||||
| "scripts": { | ||||||||||||||||||||||||||
| "dev": "vite dev", | ||||||||||||||||||||||||||
| "build": "vite build && tsc --noEmit", | ||||||||||||||||||||||||||
| "preview": "vite preview" | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| "dependencies": { | ||||||||||||||||||||||||||
| "@tanstack/solid-router": "^1.133.20", | ||||||||||||||||||||||||||
| "@tanstack/solid-router-devtools": "^1.133.20", | ||||||||||||||||||||||||||
| "@tanstack/solid-start": "^1.133.20", | ||||||||||||||||||||||||||
| "solid-js": "^1.9.5" | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
|
Comment on lines
+11
to
+16
Contributor
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. 🛠️ Refactor suggestion | 🟠 Major Use workspace: for internal TanStack packages.* Aligns with repo policy and prevents version skew during local development. As per coding guidelines. "dependencies": {
- "@tanstack/solid-router": "^1.133.20",
- "@tanstack/solid-router-devtools": "^1.133.20",
- "@tanstack/solid-start": "^1.133.20",
+ "@tanstack/solid-router": "workspace:*",
+ "@tanstack/solid-router-devtools": "workspace:*",
+ "@tanstack/solid-start": "workspace:*",
"solid-js": "^1.9.5"
},📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| "devDependencies": { | ||||||||||||||||||||||||||
| "nitro": "^3.0.1-alpha.0", | ||||||||||||||||||||||||||
| "@types/node": "^22.5.4", | ||||||||||||||||||||||||||
|
Comment on lines
+17
to
+19
Contributor
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. 🧩 Analysis chainSanity-check nitro version. Alpha versions can churn. Confirm 3.0.1-alpha.0 is intended for the example; otherwise prefer a stable 3.x. 🏁 Script executed: #!/bin/bash
# Compare nitro versions used across examples and check for non-alpha usage.
rg -n --glob 'examples/**/package.json' '"nitro":\s*".*"' -N -C1Length of output: 221 I'll search for information about the current stable nitro version to help assess whether using the alpha version here is appropriate. Let me check if there's broader context about whether this project is intentionally using Nitro v3 alpha: Update the example to use Nitro v2 (stable) instead of v3 alpha. The current stable release is Nitro v2, while Nitro v3 is still under active development and features/APIs can change before final release. Version 3.0.1-alpha.0 was published 11 days ago, confirming active churn. For a foundational example like "start-basic-nitro," using an alpha version introduces unnecessary instability and breaking-change risk for developers learning the framework. Switch to Nitro v2 (the current stable release). 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| "vite-plugin-solid": "^2.11.10", | ||||||||||||||||||||||||||
| "autoprefixer": "^10.4.20", | ||||||||||||||||||||||||||
| "postcss": "^8.5.1", | ||||||||||||||||||||||||||
| "tailwindcss": "^3.4.17", | ||||||||||||||||||||||||||
| "typescript": "^5.7.2", | ||||||||||||||||||||||||||
| "vite": "^7.1.7", | ||||||||||||||||||||||||||
| "vite-tsconfig-paths": "^5.1.4" | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| export default { | ||
| plugins: { | ||
| tailwindcss: {}, | ||
| autoprefixer: {}, | ||
| }, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "name": "", | ||
| "short_name": "", | ||
| "icons": [ | ||
| { | ||
| "src": "/android-chrome-192x192.png", | ||
| "sizes": "192x192", | ||
| "type": "image/png" | ||
| }, | ||
| { | ||
| "src": "/android-chrome-512x512.png", | ||
| "sizes": "512x512", | ||
| "type": "image/png" | ||
| } | ||
| ], | ||
| "theme_color": "#ffffff", | ||
| "background_color": "#ffffff", | ||
| "display": "standalone" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import { | ||
| ErrorComponent, | ||
| Link, | ||
| rootRouteId, | ||
| useMatch, | ||
| useRouter, | ||
| } from '@tanstack/solid-router' | ||
| import type { ErrorComponentProps } from '@tanstack/solid-router' | ||
|
|
||
| export function DefaultCatchBoundary({ error }: ErrorComponentProps) { | ||
| const router = useRouter() | ||
| const isRoot = useMatch({ | ||
| strict: false, | ||
| select: (state) => state.id === rootRouteId, | ||
| }) | ||
|
|
||
| console.error('DefaultCatchBoundary Error:', error) | ||
|
|
||
| return ( | ||
| <div class="min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6"> | ||
| <ErrorComponent error={error} /> | ||
| <div class="flex gap-2 items-center flex-wrap"> | ||
| <button | ||
| onClick={() => { | ||
| router.invalidate() | ||
| }} | ||
| class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`} | ||
| > | ||
| Try Again | ||
| </button> | ||
| {isRoot() ? ( | ||
| <Link | ||
| to="/" | ||
| class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`} | ||
| > | ||
| Home | ||
| </Link> | ||
| ) : ( | ||
| <Link | ||
| to="/" | ||
| class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`} | ||
| onClick={(e) => { | ||
| e.preventDefault() | ||
| window.history.back() | ||
| }} | ||
| > | ||
| Go Back | ||
| </Link> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { Link } from '@tanstack/solid-router' | ||
|
|
||
| export function NotFound({ children }: { children?: any }) { | ||
| return ( | ||
| <div class="space-y-2 p-2"> | ||
| <div class="text-gray-600 dark:text-gray-400"> | ||
| {children || <p>The page you are looking for does not exist.</p>} | ||
| </div> | ||
| <p class="flex items-center gap-2 flex-wrap"> | ||
| <button | ||
| onClick={() => window.history.back()} | ||
| class="bg-emerald-500 text-white px-2 py-1 rounded uppercase font-black text-sm" | ||
| > | ||
| Go back | ||
| </button> | ||
| <Link | ||
| to="/" | ||
| class="bg-cyan-600 text-white px-2 py-1 rounded uppercase font-black text-sm" | ||
| > | ||
| Start Over | ||
| </Link> | ||
| </p> | ||
| </div> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { ErrorComponent } from '@tanstack/solid-router' | ||
| import type { ErrorComponentProps } from '@tanstack/solid-router' | ||
|
|
||
| export function PostErrorComponent({ error }: ErrorComponentProps) { | ||
| return <ErrorComponent error={error} /> | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { ErrorComponent } from '@tanstack/solid-router' | ||
| import type { ErrorComponentProps } from '@tanstack/solid-router' | ||
|
|
||
| export function UserErrorComponent({ error }: ErrorComponentProps) { | ||
| return <ErrorComponent error={error} /> | ||
| } |
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.
Fix title to match directory name.
The README title is "Start Basic Netlify" but the directory is named
start-basic-nitro. This creates confusion about what the example demonstrates.Apply this diff to align the title with the directory name:
📝 Committable suggestion
🤖 Prompt for AI Agents