Remove loadConfig from main development process, pass value from child process (#88230)
## Eliminate duplicate `loadConfig` calls during development server
startup
### What?
Remove duplicate `loadConfig` calls from the parent process
(`next-dev.ts`) by passing `distDir` via IPC from the child process
where config is already loaded.
### Why?
Previously, when booting the development server:
1. The **child process** (`start-server.ts` → `router-server.ts`) would
call `loadConfig` to get the full configuration for the actual server
2. The **parent process** (`next-dev.ts`) would also call `loadConfig`
separately just to access `config.distDir` for telemetry and trace
uploads
Since these are separate processes, the in-memory config cache couldn't
be shared, resulting in redundant config loading work.
### How?
Extended the existing IPC messaging to include `distDir` when the child
process sends `nextServerReady`:
```
Parent (next-dev.ts) Child (start-server.ts → router-server.ts)
| |
|-------- fork() ------------------>|
|<------- nextWorkerReady ----------|
|-------- nextWorkerOptions ------->|
| | loadConfig() ← only called here now
|<-- nextServerReady + distDir -----|
| |
Store distDir for
telemetry/trace uploads
```
**Changes:**
- **`render-server.ts`**: Added `distDir` to `ServerInitResult` type
- **`router-server.ts`**: Return `config.distDir` in `initialize()`
result and pass to render server opts
- **`start-server.ts`**: Return `distDir` from `startServer()` and
include it in IPC message
- **`next-dev.ts`**: Receive `distDir` from IPC, remove both
`loadConfig` calls, use `distDir` directly for telemetry/trace