From 312da96d9a315f5dc50c9648fb3488ef2907b44a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Wed, 9 Sep 2026 19:03:38 +0200 Subject: [PATCH] build: type-check the application program, not the test tree, in next build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- next.config.ts | 6 ++++++ tsconfig.build.json | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tsconfig.build.json diff --git a/next.config.ts b/next.config.ts index 3ea427424..3e3a554fa 100644 --- a/next.config.ts +++ b/next.config.ts @@ -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 `` can compare the shell-baked version diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 000000000..88451f908 --- /dev/null +++ b/tsconfig.build.json @@ -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" + ] +}