Skip to content

Commit 8df1085

Browse files
JoviDeCroockclaude
andcommitted
Update skill files to use import() syntax in route manifest examples
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5f949bc commit 8df1085

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

skills/migrate-nextjs/SKILL.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ For pages router projects, you can **skip manual manifest wiring entirely** (Pha
6666
| `app/layout.tsx` | `src/shells/*.tsx` + `shells` in `defineApp` | Shells are named, not directory-nested |
6767
| `app/loading.tsx` | No direct equivalent | Use Suspense in component if needed |
6868
| `app/error.tsx` | `ErrorBoundary` export in route module | Same concept, different wiring |
69-
| `app/not-found.tsx` | 404 route: `route("*", "./routes/not-found.tsx")` | Catch-all at end of routes array |
69+
| `app/not-found.tsx` | 404 route: `route("*", () => import("./routes/not-found.tsx"))` | Catch-all at end of routes array |
7070
| `middleware.ts` | `src/middleware/*.ts` + `middleware` in `defineApp` | Named, applied per route/group |
7171
| `app/api/*/route.ts` | `src/api/*.ts` with `GET`/`POST` exports | Auto-discovered, no manifest entry |
7272
| `generateStaticParams` | `getStaticPaths()` export | Returns `RouteParams[]` of param objects |
@@ -299,7 +299,7 @@ export const middleware: MiddlewareFn = async ({ request }) => {
299299
Then apply it in the manifest:
300300

301301
```ts
302-
group({ middleware: ["auth"] }, [route("/dashboard", "./routes/dashboard.tsx", { render: "ssr" })]);
302+
group({ middleware: ["auth"] }, [route("/dashboard", () => import("./routes/dashboard.tsx"), { render: "ssr" })]);
303303
```
304304

305305
Key transforms:
@@ -319,21 +319,21 @@ import { defineApp, group, route } from "viact";
319319

320320
export const app = defineApp({
321321
shells: {
322-
main: "./shells/main.tsx",
322+
main: () => import("./shells/main.tsx"),
323323
},
324324
middleware: {
325-
auth: "./middleware/auth.ts",
325+
auth: () => import("./middleware/auth.ts"),
326326
},
327327
routes: [
328328
group({ shell: "main" }, [
329-
route("/", "./routes/home.tsx", { render: "ssg" }),
330-
route("/about", "./routes/about.tsx", { render: "ssg" }),
331-
route("/dashboard", "./routes/dashboard.tsx", {
329+
route("/", () => import("./routes/home.tsx"), { render: "ssg" }),
330+
route("/about", () => import("./routes/about.tsx"), { render: "ssg" }),
331+
route("/dashboard", () => import("./routes/dashboard.tsx"), {
332332
render: "ssr",
333333
middleware: ["auth"],
334334
}),
335-
route("/blog/:slug", "./routes/blog-post.tsx", { render: "isg" }),
336-
route("*", "./routes/not-found.tsx", { render: "ssr" }),
335+
route("/blog/:slug", () => import("./routes/blog-post.tsx"), { render: "isg" }),
336+
route("*", () => import("./routes/not-found.tsx"), { render: "ssr" }),
337337
]),
338338
],
339339
});

skills/scaffold/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ export function GET({ params, url }: BaseRouteArgs) {
111111

112112
After creating module files, **always update `src/routes.ts`** to register the new module:
113113

114-
- **Routes**: Add a `route("/path", "./routes/filename.tsx", { id: "name", render: "ssr" })` call inside the appropriate group or at the top level.
115-
- **Shells**: Add to the `shells` record: `shellName: "./shells/filename.tsx"`.
116-
- **Middleware**: Add to the `middleware` record: `mwName: "./middleware/filename.ts"`.
114+
- **Routes**: Add a `route("/path", () => import("./routes/filename.tsx"), { id: "name", render: "ssr" })` call inside the appropriate group or at the top level.
115+
- **Shells**: Add to the `shells` record: `shellName: () => import("./shells/filename.tsx")`.
116+
- **Middleware**: Add to the `middleware` record: `mwName: () => import("./middleware/filename.ts")`.
117117
- **API routes**: No manifest change needed — auto-discovered from `src/api/` by the Vite plugin.
118118

119119
Available render modes: `"ssr"` (default), `"ssg"` (static at build), `"isg"` (incremental static with `revalidate: timeRevalidate(seconds)`), `"spa"` (client-only).

0 commit comments

Comments
 (0)