next.js
141bdf87 - Avoid loading project config multiple times (#45637)

Commit
3 years ago
Avoid loading project config multiple times (#45637) While debugging another thing I found that we are loading `loadJsConfig` 3 times during a build. Inside `loadJsConfig` we load TypeScript and call `ts.readConfigFile(tsConfigPath, ts.sys.readFile)` and `ts.parseJsonConfigFileContent`, which are expensive (411ms, about 10% of the build time of a demo app): ![CleanShot-2023-02-07-90Jwesnx@2x](https://user-images.githubusercontent.com/3676859/217114840-510c254b-6a00-44b0-ab62-138f32398849.png) In one process these things are the same for all compilers and we should reuse them. NEXT-469 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
Author
Parents
Loading