Migration v2 to v3 increased the build time by 10+

Hi, I was working on a Nuxt2 application. For some reason, the project was forked and migrated to Nuxt3 few months ago. Both project (Nuxt2 & Nuxt3) continued to receive updates. As of today, the Nuxt2 application + a Laravel build is done in less than 2-3 minutes while the Nuxt3 application only (I separated the Laravel app build in the CI/CD) takes an average time of 15-25 minutes and sometimes even more 45! The applications aren't build on equivalent hardware configuration: 8Gb ram, 4vCPU. I trying to improve the performance of the Nuxt3 build during the CI/CD, copying the old node_modules folder from the previous build to not redownload already installed package, using pi0/nuxt-build-cache package and so on... Is that normal that a Nuxt3 build takes way more time to run than Nuxt2? Here are some results information of the builds:
up to date, audited 1398 packages in 26s
[log] Nuxt 3.12.2 with Nitro 2.9.6
[info] vite v5.3.1 building for production...
[info] transforming...
[info] ✓ 2129 modules transformed.
[info] rendering chunks...
[info] computing gzip size...
[info] ✓ built in 2m 42s
[success] Client built in 162181ms
[info] Building server...
[info] vite v5.3.1 building SSR bundle for production...
[info] transforming...
[info] ✓ 1066 modules transformed.
[info] rendering chunks...
[info] ✓ built in 2m 20s
[success] Server built in 140325ms
[info] [nitro] Initializing prerenderer
[info] [nitro] Prerendering 2 routes
[info] [nitro] Prerendered 1 routes in 366.645 seconds
[start] [nuxt-build-cache] Collecting nuxt build cache
[success] [nuxt-build-cache] Nuxt build cache collected in `2612ms`
up to date, audited 1398 packages in 26s
[log] Nuxt 3.12.2 with Nitro 2.9.6
[info] vite v5.3.1 building for production...
[info] transforming...
[info] ✓ 2129 modules transformed.
[info] rendering chunks...
[info] computing gzip size...
[info] ✓ built in 2m 42s
[success] Client built in 162181ms
[info] Building server...
[info] vite v5.3.1 building SSR bundle for production...
[info] transforming...
[info] ✓ 1066 modules transformed.
[info] rendering chunks...
[info] ✓ built in 2m 20s
[success] Server built in 140325ms
[info] [nitro] Initializing prerenderer
[info] [nitro] Prerendering 2 routes
[info] [nitro] Prerendered 1 routes in 366.645 seconds
[start] [nuxt-build-cache] Collecting nuxt build cache
[success] [nuxt-build-cache] Nuxt build cache collected in `2612ms`
Some of these numbers are really weird like it take 6 minutes to prerender one route?!
4 Replies
Romain 'Maz' B.
Romain 'Maz' B.OP5mo ago
I almost doubled the server performance: now 16Gb RAM & 6vCPU, the build time remains the same: 16 minutes for the last build, and still that huge 251 seconds to prerender one route...
manniL
manniL5mo ago
it should be the opposite, nuxt 3 is in most projects faster than nuxt 2 for the plain client/server build process More info would help 🙂
Romain 'Maz' B.
Romain 'Maz' B.OP5mo ago
What could help? Here are the full build log and my nuxt config. https://gist.github.com/RomainMazB/fa9bbe28fcc8b33feb352b607b82e402 As a side note: I tried to build the app on my local machine, the build time is acceptable, like 3-4 minutes without all the cache optimization and so on... This may have something with the server configuration, but why? What could cause the build time to be so long? The CI process is ran by an hosted gitlab-runner, so there cpu/memory limitation is the machine one detailed earlier. @manniL / TheAlexLichter just to inform you since you are most active than me here. I tried a long shot this morning when discovered this gitlab runner issue: https://forum.gitlab.com/t/high-output-crashed-gitlab-runner-sync-with-gitlab-job/62068 I noticed that the gitlab instance actually crashed when nuxt was building, then it has to reboot and then continue the build (which is why the build time was so long). I just modified my CI job to make it silent:
- node run build --log-level silent
- node run build --log-level silent
Now my app is built in less than 3 minutes 🙂
manniL
manniL5mo ago
ah, interesting! so the log overhead caused that long a build, crazy thanks for sharing
Want results from more Discord servers?
Add your server