next.js
acb74eb5 - [CLI] Exit non-zero with a clear message when next typegen fails (#94241)

Commit
188 days ago
[CLI] Exit non-zero with a clear message when next typegen fails (#94241) The `typegen` command chained `nextTypegen(...).then(() => process.exit(0))` with no rejection handler. When `next.config` throws during `loadConfig`, the rejection is orphaned by the synchronous `program.parse` and then absorbed by Next's `unhandledRejection` filter, so the process exits `0` having written no route types. A later `tsc` then reports `Cannot find name 'PageProps'`/`'LayoutProps'` (and missing `*.png` modules) with nothing tying it back to typegen. Add a `.catch` that prints an actionable message about the missing route types and `process.exit(1)`, so `next typegen && tsc` halts on failure. Includes an e2e test whose fixture config throws and asserts a non-zero exit with the diagnostic. <!-- NEXT_JS_LLM_PR -->
Author
Jude Gao
Parents
Loading