Part 01 / Topic 8 of 9
next.config.ts and tsconfig.json, read line by line
harness/next.config.ts, exactly as create-next-app wrote it:
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
cacheComponents: true,
partialPrefetching: true,
turbopack: {
rules: {
"*.css": {
loaders: ["@tailwindcss/turbopack"],
as: "*.css",
},
},
},
};
export default nextConfig;
| Line | Meaning |
|---|---|
cacheComponents: true |
Nothing is cached unless a lesson explicitly says use cache (Stage 3) — this is what makes ○ above mean "no cache directive needed, this page just has no dynamic data" rather than "cached by default" |
partialPrefetching: true |
Lets Next.js prefetch the static part of a page even when another part is dynamic — pairs with ◐ above, not used yet |
turbopack.rules["*.css"] |
Routes .css files through Tailwind's Turbopack loader — this is what --tailwind actually wired up, not a separate Tailwind config file |
Both booleans were set by the scaffold without being asked for on the command line — confirmed directly from the installed package's docs (section 2's 01-installation.md), which lists "Cache Components" in the recommended-defaults prompt. Treat this file as the single source of truth for what is turned on, never assume a flag's default from memory.
harness/tsconfig.json, the parts worth reading on day one:
{
"compilerOptions": {
"strict": true,
"moduleResolution": "bundler",
"jsx": "react-jsx",
"plugins": [{ "name": "next" }],
"paths": { "@/*": ["./*"] }
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts",
"**/*.mts"
]
}
| Line | Meaning |
|---|---|
"strict": true |
Full strict-mode TypeScript, the recommended default, not relaxed for this course |
"plugins": [{ "name": "next" }] |
The editor-only Next.js TypeScript plugin — adds route-aware autocomplete in VS Code/IntelliJ |
"paths": { "@/*": ["./*"] } |
The @/ import alias from section 3's --import-alias flag |
.next/types/**/*.ts in include |
Route types Next.js generates on every dev/build run — this is exactly what caught the broken page in the "Common mistakes" table below |
One fact confirmed directly in harness/app/layout.tsx, not asserted from memory: its RootLayout function is typed as LayoutProps<"/"> —
export default function RootLayout({ children }: LayoutProps<"/">) {
LayoutProps is one of the generated, route-aware global types .next/types/ produces; it does not exist in a plain JavaScript project, because there is nothing to generate it from. This is the concrete payoff of this course teaching TypeScript from Part 1.
Done here? The practice set for Part 1 — including the solutions — is on the part page.