How much memory Nuxt 5 saves when several agents build at once

Aron Schüler Published


Table of Contents

I have several coding agents working on the same Nuxt app at once. Each one has its own checkout, and each one may run a full production build whenever it feels like it. A dev server holds about 2 GB and a browser about 0.5 GB. But a full build peaks at 4.7 GB. On a 24 GB laptop, that’s the single biggest memory spike an agent causes.

So I wanted to know: does Nuxt 5 make this better? I built the same commit with Nuxt 4 and with the Nuxt 5 nightly, with 1, 2, 4 and 6 builds running at once.

This wasn’t theoretical. At the end of October the 24 GB laptop kept running out of memory. When I measured on 2026-10-30, one nuxt dev server reached 2.5–3.3 GB after seven pages. About 19 agent sessions held idle browser servers (~2 GB together), and seven browser instances stayed open after their agent was done (~1.9 GB). Capping the dev server’s heap and making agents clean up after themselves fixed the steady state. Builds were the spike nothing had touched yet.

TLDR

  • Nuxt 5 cuts the peak memory of each build by about 20%.
  • It builds 2.3× faster, so the memory held over a build’s life drops by about 74%.
  • Peak memory still grows by one build’s worth per concurrent build. 6 builds peak at 21.7 GB on Nuxt 5 vs 27.3 GB on Nuxt 4.
  • Nuxt 5 isn’t released yet. I used the nightly from 2026-11-15, and its output doesn’t boot in my app yet.

What kind of app is this?

It’s a server-rendered Nuxt 4 app with a few hundred API routes and Prisma, inside a pnpm monorepo. Not a toy:

MeasureValue
Vue single-file components623 (99 pages, 522 components)
Lines of Vue~112,000
TypeScript files in the app~1,200 (~127,000 lines)
TypeScript in shared monorepo packages~60,000 lines
Server route files416 (749 server-side TypeScript files)
Database models (Prisma)119
Monorepo workspace packages16
node_modules1,451 packages, 1.3 GB
Nuxt modulesPinia, Icon, UI, ESLint, Fonts, VueUse, Sentry
ToolchainNode 26, Vite 8, Vue 3.5, Nitro 2.13

A solo Nuxt 4 build takes 61–66 s. The client bundle (4,898 modules) takes 11.2 s, the SSR bundle (2,618 modules) 8.3 s, and the Nitro server bundle plus file tracing eats most of the rest. Memory peaks in the last seconds, while the server bundle is written. That’s true for both versions.

Why is it so heavy to build?

A few things add up:

  • One server bundle for everything. 416 route files, the generated Prisma client for 119 models, auth, error reporting and a WebSocket handler all end up in a single Nitro bundle.
  • Libraries that drag in code I never run. The auth library references database adapters I don’t use (Kysely, Drizzle, MongoDB). ECharts (~4.8 MB with its renderer) gets imported for types in server-rendered components. Both are aliased to an empty stub on the server build.
  • A native binary. The image renderer (resvg) ships a platform-specific .node file that has to stay outside the bundle.
  • Types at the limit. The typed $fetch over 416 routes sits right at TypeScript’s type-instantiation limit. One more route key and it breaks.
  • Icons scanned from code. The icon module scans every .vue and .ts file for icon names to build a 190-icon client bundle.

Peak memory

Peak memory of 1, 2, 4 and 6 concurrent builds, Nuxt 4 vs Nuxt 5. Nuxt 5 is about 20% lower at every level; 6 Nuxt 4 builds cross the 24 GB line.

Median of 3 runs per level, summed PSS of all build processes. The dashed line is 24 GB.

Concurrent buildsNuxt 4 peakNuxt 5 peakDifference
14.7 GB3.7 GB−21%
29.2 GB7.5 GB−18%
418.1 GB14.7 GB−19%
627.3 GB21.7 GB−21%

That’s about 4.6 GB per build on Nuxt 4 and 3.7 GB on Nuxt 5, in a straight line.

Builds share almost nothing. So N agents building at once cost N × one build’s peak. On the 24 GB laptop, leaving a few GB for macOS, that’s about four Nuxt 4 builds or five Nuxt 5 builds. Six Nuxt 5 builds technically squeeze under 24 GB, six Nuxt 4 builds don’t. So Nuxt 5 buys me one more build, not a different league.

Build time is where Nuxt 5 really wins

Nuxt 5 finishes every scenario in less than half the time. Multiply memory by time and it holds 74% less:

Concurrent buildsNuxt 4 wall time (s)Nuxt 5 wall time (s)Nuxt 4 GB·sNuxt 5 GB·s
1632720754
26929447117
482361,033288
6101441,941511

This matters most when agents start their builds at different times. With shorter builds, the peaks overlap less often.

How I measured

Both variants built the same commit with the same Node 26, lockfile and Vite 8. Only the Nuxt package was different:

Nuxt 4Nuxt 5
Nuxt4.5.2nightly 5.0.0-2611150147-d897f4c
Server bundlerNitro 2.13 (rollup)Nitro v3 RC (rolldown)
Code changesnoneversion overrides, named exports in one SSR stub
  • Machine: 16 cores, 62 GB RAM, Linux. Other agents’ sessions kept running as usual.
  • Builds: cold nuxt build, every concurrent build in its own checkout, output and caches wiped before every run.
  • Matrix: 1, 2, 4 and 6 builds × 3 repetitions × 2 variants = 24 runs. I alternated Nuxt 4 and Nuxt 5 so drift on the machine cancels out. All 24 exited 0, and repetitions were within about 3% of each other.
  • Measuring: every 250 ms I summed the PSS of each build’s process tree. PSS counts shared memory once, so parallel builds add up honestly. I also tracked available memory and the kernel’s memory-stall counter (PSI). A guard would have killed everything below 6 GB available. It never fired, and PSI stayed at 0 ms the whole time.

The catch: Nuxt 5 output doesn’t run yet

The Nuxt 5 build does the same work, but moving to it is a migration, not a version bump:

  • Rolldown is stricter. Missing exports are errors where rollup only warned. My empty stub for the unused database adapters had to export the names the auth library imports.
  • Two settings ignored. Nitro v3 drops the externals option, and my custom $fetch template failed to compile (just a warning).
  • Output size. Client assets were 18 MB on both (453 vs 389 JS chunks). The server bundle went from 55 MB to 33 MB, but partly because externals was ignored.
  • It doesn’t boot. The Sentry module’s server instrumentation calls defineEventHandler, a Nitro 2 global that Nitro v3 doesn’t provide anymore. The Nuxt 4 output booted and served pages and API routes just fine.
  • More migration work. My server code targets Nitro 2 and h3 v1, the Sentry module isn’t ready for Nitro v3, and Nuxt 5 wants Vue 3.5.45 and Vue Router 5.5 (I’m on 3.5.44 and 5.4.0).
  • It’s a nightly. The numbers may move before a stable release.

What I still don’t know

  • Is 20% less peak memory and a 2.3× faster build worth the Nitro v3 migration once Nuxt 5 is stable?
  • Would a Node heap cap (--max-old-space-size) on Nuxt 4 cut the peak more than Nuxt 5 does? I haven’t measured that yet. The same cap already took a dev server from 2.5–3.3 GB down to 2.1 GB.
  • Do the numbers hold on the actual 24 GB laptop under real memory pressure? The 62 GB machine never came close to swapping.

I won’t wait for Nuxt 5 to fix this. The heap cap is one environment variable, works on Nuxt 4 today, and already worked for the dev server, so I’ll measure it on builds first. I’ll migrate once Nuxt 5 is stable and the Sentry module supports Nitro v3. The 2.3× faster build is the part I actually want: agents waiting on builds cost more than the memory.

Thanks for reading!


Related Posts

Find posts on similar topics:


Support me via buymeacoffee

If I helped you solve a problem or you just like my content, consider supporting me by buying me a coffee.

Buy me a coffee

Comments