mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
### What? Adds a new environment variable `NEXT_TURBOPACK_TRACING_PATH` that lets users specify the full output path (including filename) for the Turbopack trace file. ### Why? Some users need to control where the `trace-turbopack` file is written — for example, to redirect it outside the project directory, to a shared volume, or to a custom filename. Previously the path was hardcoded to `<project>/.next-profiles/trace-turbopack` with no override mechanism. ### How? When `NEXT_TURBOPACK_TRACING` is set (tracing is enabled) and `NEXT_TURBOPACK_TRACING_PATH` is also set, the trace is written to the specified path instead of the default: - **Absolute paths** are used as-is. - **Relative paths** are resolved against the process CWD. - The **parent directory is auto-created** recursively (equivalent to `mkdir -p`), so pointing to a non-existent subdirectory works without manual setup. - Setting `NEXT_TURBOPACK_TRACING_PATH` alone (without `NEXT_TURBOPACK_TRACING`) has no effect — tracing is not enabled by it. - The "Trace output will be written to …" message reflects the resolved path. The change is confined to `crates/next-napi-bindings/src/next_api/project.rs`. **Example:** ```sh NEXT_TURBOPACK_TRACING=overview \ NEXT_TURBOPACK_TRACING_PATH=/tmp/my-project-trace \ next dev ``` <!-- NEXT_JS_LLM_PR --> Co-authored-by: Tobias Koppers <[email protected]> Co-authored-by: Claude <[email protected]>