Build failure: custom `typescript.tsconfigPath` from `next.config` not honored
#1,449 创建于 2026年5月22日
仓库指标
- Star
- (8,120 star)
- PR 合并指标
- (平均合并 1天 1小时) (30 天内合并 462 个 PR)
描述
This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext
mainvs Next.jsv16.2.6, 2026-05-22).
Problem
When next.config.js specifies a non-default typescript.tsconfigPath, the vinext production build fails entirely with Custom deploy script failed: undefined (1). The build pipeline appears to assume the default tsconfig.json and does not forward the user-specified path to the TypeScript / Vite compiler. Affects App Router, Pages Router, and middleware variants of the test fixture.
Error: Custom deploy script failed: undefined (1)
at NextDeployInstance.deployUsingCustomScript
Estimated Impact
~6 test failures across the deploy suite.
Affected Test Suites
test/e2e/tsconfig-path/index.test.ts(3 failures)test/e2e/typescript-custom-tsconfig/test/index.test.ts(3 failures)
Recommendation
-
Reproduce first in vinext's own test suite. Add a test fixture with
tsconfig.app.jsonandtypescript: { tsconfigPath: './tsconfig.app.json' }innext.config.js. Confirm the build currently fails. -
Study how Next.js loads the typescript config. Search
.nextjs-ref/packages/next/src/build/fortsconfigPathto understand the resolution order and what the path is used for (paths, baseUrl, JSX runtime). -
Forward the custom path to Vite/Rolldown. Read
typescript.tsconfigPathfrom the resolved next config and pass it as thetsconfigoption to Vite's TypeScript handling (or load the file and merge itscompilerOptions.paths/baseUrlinto the Vite resolve options). -
Check dev/prod parity. Apply the same resolution in both
server/dev-server.tsand the production build.