Slow build times in nitro server build
Hi! My build times of my Nuxt app are this, it is normal? The nitro server take too much time
Client 6.66s
Server 6.27s
Nitro Server 56s
Any ideas how improve it or how to debug this? This is the analyze data.
"Σ Total size: 61.6 MB (17 MB gzip)" (i use Nuxt Image so is sharp included)

2 Replies
Hi @Nisgrak. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Long Nitro server build times (like 56s) are not typical for most Nuxt projects, but can happen, especially with large projects or heavy dependencies like Sharp (used by Nuxt Image). Here are some steps and insights from the knowledge sources to help you debug and improve your build times:
1. Analyze Bundle Size and Dependencies
A total output size of 61.6 MB (17 MB gzip) is quite large. Unused code, dependencies, or assets can significantly slow down builds. Review your
package.json
and project files for unused dependencies or code, and remove anything unnecessary. This is a common performance issue in Nuxt projects and cleaning up can help reduce build times and output size Nuxt performance: Common problems.
2. Use Nuxt DevTools for Analysis
Nuxt DevTools provides a "Build Analyze" tab where you can inspect your bundle size and compare builds. It also offers insights into assets, plugins, and modules, which can help you identify bottlenecks or large dependencies Nuxt DevTools Features.
3. Heavy Dependencies (e.g., Sharp)
Sharp (used by Nuxt Image) is a native dependency and can slow down builds, especially on cold builds or in CI/CD environments. If possible, ensure you are using the latest versions and that your build environment has the necessary system libraries pre-installed to avoid repeated compilation.
4. Try Build Caching
There is a community module that brings back build caching for Nuxt 3, which can significantly speed up rebuilds and deploys by caching parts of the build that haven't changed. You can learn more about it in this YouTube video and the nuxt-build-cache module.
5. Debugging Slow Builds
- Use the Nuxt DevTools "Timeline" and "Inspect" features to see which parts of your app take the most time to build or initialize.
- Check for overuse of plugins or expensive server-side computations.
- If you are using a lot of server routes or API endpoints, review their complexity and optimize where possible.
6. General Tips
- Exclude large files or folders (like .output
) from version control to avoid unnecessary processing.
- If you are running builds in Docker or CI, ensure you are using buildx or similar tools for better performance Stack Overflow: Docker buildx.
If after these steps your Nitro server build is still unusually slow, try to isolate the cause by disabling modules one by one or creating a minimal reproduction. Sometimes, a specific module or plugin can be the bottleneck.
If you need more targeted help, sharing your Nuxt config and a breakdown of your dependencies can help the community provide more specific advice.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@201760335076524041> Kapa.ai is still learning and improving, please let me know how I did by reacting below.