Repository navigation
fix(devtools): stop inlining every dependency into the Nitro v2 dev bundle - #1109
Conversation
…rver boots Since a1fcef8 the catalog resolves nitro 3.0.260903-beta while the pinned Nuxt nightly still depended on 3.0.260610-beta. With two Nitro copies installed, Nuxt's nitro:dev-service-proxy fails to load nitro/h3 from the second one and every dev server in the repo 500s, which is why e2e has hung and been cancelled on every run since. Move to the current Nuxt nightly, which depends on nitro 260903 itself, and drop the 260610 patch: 260903 already skips the nitro build for static generates upstream.
Its nuxi prepare now declares every #build template as an ambient module and resolves #imports for real, so the ts-expect-error on the settings import becomes unused and the client plugin's inferred type cycles through the composables it calls.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe Nitro v2 and v3 configuration branches now handle the inline runtime path separately, with tests covering both versions. The client plugin uses a Nuxt Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to No material merge-blocking issue was established. The supported Nitro configuration and tracked client build path retain the required behavior. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 4 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 6 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
build:client re-stubbed @nuxt/devtools through dev:prepare after turbo had already built it, so a root pnpm build left a jiti stub in dist. The published package was unaffected (prepack builds only the module), but everything packing after a root build shipped the stub. The client only needs the built module for types, which turbo already orders first. Also use ts-ignore for the #build/devtools/settings import: whether nuxi prepare declares it depends on the setup, so ts-expect-error fails in one environment or the other.
…undle The nitro:config hook set noExternals to a list whenever the key was absent. That is the Nitro v3 spelling; on Nitro v2 (nitropack, every Nuxt 4 app) noExternals is a boolean, so a non-empty array is truthy and Nitro bundles the whole dependency graph into the dev server. Small apps only got slower; the ecosystem playground failed outright (nuxt-og-image dragging playwright in, vite-node's debug shim crashing on enable(true)). Branch on the config shape instead: externals.inline when the config has externals (v2), the noExternals list otherwise (v3).
3c38af2 to
2681ffc
Compare
Stacked on #1107.
Found while re-running the ecosystem playground on Nuxt 4.5 for the stable release. The
nitro:confighook inmodule-main.tssetsnoExternals = [<runtime/nitro>]whenever the key is absent. That is the Nitro v3 spelling; on Nitro v2 (nitropack, i.e. every Nuxt 4 app)noExternalsis a boolean, so a non-empty array is truthy and Nitro bundles the entire dependency graph into the dev server (Cannot resolve … and externals are not allowed!).Small apps only got slower, which is why the minimal
playgrounds-ecosystem/nuxt4app still passed. The combined ecosystem app failed outright:nuxt-og-imageresolvedplaywrightand Nitro died onelectron/index.js, and even without that the inlinedvite-nodedebugshim crashed the server withglobalNamespaces.trim is not a function.Nuxt 4 always provides
externals.inlineand nevernoExternals; Nuxt 5 does the reverse. The hook now branches on that shape instead of falling through to the v3 path. Covered by a unit test for both shapes (thefakeNuxtharness fromdevtools-origin.test.tsis shared for it), and verified by booting thenuxt4andnuxt5playgrounds plus the full ecosystem Playwright suite (follow-up PR).Created with the help of an agent.