If you want to analyze why your Next.js build is slow, using .next/trace
is what you need. But it's not documented.
To analyze in your CLI:
Make sure to have pnpm installed.
git clone https://github.com/vercel/next.js.git && cd next.js
pnpm i
node scripts/trace-to-tree.mjs /your/app/.next/trace
To analyze with Jaeger:
First make sure to have Docker and Cargo/Rust installed.
docker run --rm --name jaeger \
-e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
-p 6831:6831/udp \
-p 6832:6832/udp \
-p 5778:5778 \
-p 16686:16686 \
-p 4317:4317 \
-p 4318:4318 \
-p 14250:14250 \
-p 14268:14268 \
-p 14269:14269 \
-p 9411:9411 \
jaegertracing/all-in-one:1.52
git clone https://github.com/vercel/next.js.git && cd next.js
pnpm i
cd scripts/send-to-jaeger
cargo run /your/app/.next/trace
At the top of the output, the trace URL will be logged:
Jaeger trace will be available on http://127.0.0.1:16686/trace/ae9e5ca034dca21e
Sources:
Tim's comments at https://github.com/vercel/next.js/issues/45529
Top comments (0)