-
Medium sized project with Nuxt 3.10.3 with Nitro 2.9.6 and Vite 5.2.8. When running Client and server build steps are quick (~40s), building in SPA mode is quick too. Unfortunately I can't share my project publicly. I've tried using |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This seem to be somehow related to our custom nuxt modules (have 40+) as after removing all of them build is down to ~2min. Each module seem to add couple minutes of extra build time (some less, some more). What I did so far is injecting custom rollup plugin for logging what's happening:
This has shown that majority of time is spent on module resolution, e.g.:
Same modules are being resolved multiple times (thousands?), each resolution takes few ms but due to sheer number of them all this piles up to many minutes. |
Beta Was this translation helpful? Give feedback.
-
Nitro uses rollup build programmatically, in order to debug build a custom rollup plugin with Rollup perf option is a useful one, but it doesn't work out of the box with programmatic approach, thus rollup source
Same place can be used to inject logging plugin to Both these approaches didn't show clear cause of the issue, but gave some useful hints. Ended up removing rollup plugin by plugin to understand which one was taking most of the time that showed that nitro's Enabling legacyExternals resolved the issue (build finishes in 2min now). Related: unjs/nitro#2369 unjs/nitro#2367 |
Beta Was this translation helpful? Give feedback.
Nitro uses rollup build programmatically, in order to debug build a custom rollup plugin with
console.log
's on different rollup hooks (as suggested here ) can be injected into rollup config.Rollup perf option is a useful one, but it doesn't work out of the box with programmatic approach, thus rollup source
node_modules/nitropack/dist/nitro.mjs
has to be manually updated:Same place can be used to inject loggi…