next.js
90af4259 - Development: Remove TypeScript from the hot path during bootup (#84090)

Commit
97 days ago
Development: Remove TypeScript from the hot path during bootup (#84090) ## What? Changes the way TypeScript config validation behaves. It no longer does `require('typescript')` and instead reads the `tsconfig.json`. This introduces one new limitation which is that `extends` and `references` cause the automatic config rewriting to be skipped, i.e. it does not verify your `extends`​ / `references`​. In my opinion that tradeoff is fine though because if you're using these you likely already don't want Next.js to actively write into the project config file. At least that has been a common feedback from the community. In cpu profiles this change shows 115ms -> 4ms. Why does it take 115ms? TypeScript itself is quite large, lot of code to parse. However, we're only reading a few values from it like the version, some config options, and the config reading logic itself. In the CPU profile it really is showing 4ms spent in Next.js and the rest is the process of requiring TypeScript.
Author
Parents
Loading