Next.js trace to tree CLI
This tools is just a package version of trace-to-tree.mjs in Next.js repository.
- Generate trace file via
next build
command - Run
nextjs-trace-to-tree
command with trace file path
rm -rf .next && npm run build # next build
npx nextjs-trace-to-tree ./.next/trace # specify trace file path as 1st argument
Explanation:
module /Users/next-user/src/magic-ui/pages/index.js 24 s (total 33 s, self 163 ms) [read-resource 873 µs, next-babel-turbo-loader 135 ms]
════════╤═══════════════════════════════════ ═╤═ ═╤═ ═╤════ ═══════════╤════════════════════════════════════════
└─ name of the processed module │ │ │ └─ timings of nested steps
│ │ └─ building the module itself (including overlapping parallel actions)
│ └─ total build time of this modules and all nested ones (including overlapping parallel actions)
└─ how long until the module and all nested modules took compiling (wall time, without overlapping actions)
module lodash (lodash/camelCase.js + 281) 295 ms (self 958 ms) [read-resource 936 ms]
═╤════ ══════╤════════════ ═╤═
│ │ └─ number of modules that are merged into that line
│ └─ first module that is imported
└─ npm package name
- https://github.com/vercel/next.js/blob/canary/scripts/trace-to-tree.mjs
- trace-to-treeでNext.jsの起動タイムをトレースする #パフォーマンス - Qiita
- Next.jsでtraceの解析結果を表示する
- Next.js製アプリケーションのコンパイルを約100倍高速化した話
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
MIT
MIT Vercel