fix(nuxt): Detect Nitro version via the app's Nuxt dependency chain - #24019
Merged
Conversation
s1gr1d
requested review from
chargome and
mydea
and removed request for
a team
September 3, 2026 13:07
Contributor
size-limit report 📦
|
Lms24
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In a monorepo where a
nitrov3 package is resolvable above a Nitro-v2 Nuxt app, the SDK registers the Nitro v3 plugin variants and the app silently loses storage, database, and cache instrumentation.Nitro v2 is published as
nitropack, v3 asnitro.getNitroMajorVersion()asked local-pkg for any package namednitrowith no anchor. Module resolution walks up the directory tree, so an unrelatednitrov3 higher up (for example a workspace-root devDependency) wins even though the app's Nuxt importsnitropackv2.The fix follows the dependency chain Nuxt itself imports Nitro through: resolve
nuxtfromrootDir, hop to@nuxt/nitro-serverwhen nuxt declares it (Nuxt >= 3.21), and only resolvenitroif that provider declares it.nitropackinstead means v2:nuxt→nitropack@2nuxt→@nuxt/nitro-server→nitropack@2nuxt→@nuxt/nitro-server(-nightly) →nitro@3