build: type-check the application program, not the test tree, in next build

next 16.3 type-checks the whole tsconfig program during the build. That
reaches the unit tests under src/**/__tests__, their fixtures under
tests/, the Playwright config and the e2e tree, none of which is in the
image build context — .dockerignore leaves tests/ and e2e/ out on
purpose — so the image build stopped at "Cannot find module
'../../tests/fixtures/...'" on both architectures.

The build now reads tsconfig.build.json, which extends the main tsconfig
and excludes the test tree and the test-runner configs. `pnpm typecheck`
keeps using tsconfig.json and still covers the full program; the change
narrows only what `next build` compiles, which was already the case on
16.2 by omission. Verified by building with tests/ and e2e/ moved away.
This commit is contained in:
Marc-André Bombeck committed 2026-09-09 19:03:38 +02:00
1 parent 47953f5b8a
commit 312da96d9a
2 files changed
+23

No files matched your search

+6
View File
@@ -5,6 +5,12 @@ import { version as PKG_VERSION } from "./package.json";
const nextConfig: NextConfig = {
output: "standalone",
// `next build` type-checks the whole tsconfig program since 16.3, which
// reaches the unit tests under `src/**/__tests__` and their fixtures under
// `tests/`. The image build context leaves `tests/` and `e2e/` out on
// purpose, so the build reads a tsconfig without them; `pnpm typecheck`
// still covers the full program.
typescript: { tsconfigPath: "tsconfig.build.json" },
poweredByHeader: false,
// v1.4.38.4 — expose the package.json version to the client bundle
// so the `<VersionPoller>` can compare the shell-baked version
+17
View File
@@ -0,0 +1,17 @@
{
"extends": "./tsconfig.json",
"exclude": [
"node_modules",
"scripts",
"tests",
"e2e",
"src/**/__tests__/**",
"src/**/*.test.ts",
"src/**/*.test.tsx",
"playwright.config.ts",
"vitest.config.ts",
"vitest.config.mts",
"vitest.integration.config.ts",
"vitest.integration.config.mts"
]
}