outputFileTracing increases export build time by 1.5-2x #66150
Labels
bug
Issue was opened via the bug report template.
Performance
Anything with regards to Next.js performance.
Upstream
Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).
Link to the code that reproduces this issue
https://github.com/lnewson/nextjs-reproduction
To Reproduce
yarn build
and take note of the time (~5s for me)next.config.ts
and changeoutputFileTracing
totrue
(or just delete it)yarn build
and take note of the time (~8s for me)yarn build
, but note it makes little to no difference.Current vs. Expected behavior
We've not long upgraded to Next.js 14 and logging this issue per the following warning added in Next.js 14:
The expected behaviour would be that the file tracing can either be disabled still or that having it enabled does not drastically reduce export build performance. Ideally for export builds, as I cannot see a reason for it in that case, it would be good if it didn't run at all.
Provide environment information
Which area(s) are affected? (Select all that apply)
Performance, Upstream
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
For our use case we are just using Next.js as a static site generator and then hosting the generated output using a webserver. So having the file tracing done does not help us in anyway I'm aware of and I'm not sure it even makes sense for it to be running in
export
mode?In our production system the file tracing performance issue is much worse (~2000 mdx pages). Build times go from ~6mins to ~10-12mins (these run on linux/ubuntu AWS EC2 instances).
This issue also occurred throughout various versions of Next.js 13. I also tested this using Next.js 14.1.4 as an early upgrade PoC. I'm not sure if it ever didn't cause an issue with export performance as we've only used Next 13.2 or higher.
I've left all dependencies in package.json in case that helps to debug issues (excluding 2 internal only ones as those cannot be included).
Note: I've made each build clear any caches to reproduce the issue more clearly. Having a cache does not impact the file tracing time though in testing and in fact just makes the proportions worse as the webpack build part takes less time.
The text was updated successfully, but these errors were encountered: