You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🐞 Bug fix (a non-breaking change that fixes an issue)
📚 Description
On Nitro 3 (Nuxt 5, or Nuxt 4 with nitro and @nuxt/nitro-v3-server installed), the module made Nuxt apply its Nitro v2 compatibility layer and warn about the module itself:
NUXT_B9003: the module's server code imports nitropack/runtime and #imports.
NUXT_B9001: the module sets nitro.esbuild, which Nitro 3 ignores.
NUXT_B9002, on Nuxt 4 only: the media middleware has no route.
What changed:
Snapshot loaders: they read server assets through a #content/storage alias. resolveServerVariant points it at nitro/storage on Nitro 3 and at nitropack/runtime on Nitro 2.
v3 server composables:v3/composables.server.ts imports content from a #content/server alias instead of #imports. Its nuxt/server import is type-only, so it is stripped from dist and Nuxt flagged the file.
nitro.esbuild: only set on Nitro 2. Nitro 3 already targets esnext.
Media middleware: it gets route: '/**' on Nitro 3. Nitro 2 reads route as a prefix, so it still gets none there.
Types: a generated content/aliases.d.ts declares both aliases for the app tsconfig.
Tests:test/nitro3.test.ts runs nuxt prepare and nuxt build on two fixtures, nuxt5 (pinned nightly) and nuxt4-nitro3. It fails on NUXT_B9001, NUXT_B9002 or NUXT_B9003. Each fixture has its own lockfile, and CI installs both before vitest.
Evidence
nuxt build of the same app, with the published v4 build (50232f9) as Before and this branch packed as After.
Nuxt 5, Before:
● Nuxt 5.0.0-2611271344-0b7a0bd (with Nitro 3.0.261103-rc, Vite 8.4.0 and Vue 3.5.46)
WARN [NUXT_B9001] The following nitro config options are no longer supported by Nitro v3 and were ignored: esbuild.
WARN [NUXT_B9003] Nitro v2 compatibility was applied to server code from 1 module, because of what it imports:
- @nuxt/content (imports #imports, nitropack/runtime)
◆ Build complete in 2.53s
Nuxt 5, After:
● Nuxt 5.0.0-2611271344-0b7a0bd (with Nitro 3.0.261103-rc, Vite 8.4.0 and Vue 3.5.46)
◆ Build complete in 3.30s
Nuxt 4.7 + Nitro 3, Before:
● Nuxt 4.7.0 (with Nitro 3.0.261103-rc, Vite 8.4.0 and Vue 3.5.46)
WARN [NUXT_B9001] The following nitro config options are no longer supported by Nitro v3 and were ignored: esbuild.
WARN [NUXT_B9002] 1 Nitro v2 handler has no route, which Nitro v3 requires:
- @nuxt/content/dist/runtime/server/internal/assets-middleware
WARN [NUXT_B9003] Nitro v2 compatibility was applied to server code from 1 module, because of what it imports:
- @nuxt/content (imports #imports, nitropack/runtime)
◆ Build complete in 3.06s
Nuxt 4.7 + Nitro 3, After:
● Nuxt 4.7.0 (with Nitro 3.0.261103-rc, Vite 8.4.0 and Vue 3.5.46)
◆ Build complete in 3.31s
nuxt prepare on Nuxt 5 prints the same B9001 and B9003 before, and nothing after. With content/ deleted, the production server still renders the page from the snapshot and serves a media file (200 image/png) on Nuxt 4.7 + Nitro 2, Nuxt 4.7 + Nitro 3 and Nuxt 5.
test/nitro3.test.ts (both fixtures, prepare and build):
Test Files 1 passed (1)
Tests 4 passed (4)
Lint, prepack and typecheck pass, and the full vitest suite passes on Nuxt 4.7.
What the test can't catch: vitest runs against the stubbed dist, which links to src, so it can't catch a type-only nuxt/server import being stripped from dist. That case was checked with a packed tarball.
Nuxt 4 still turns the layer on: Nuxt 4 enables nitroLegacy by default on Nitro 3, so the layer stays on for the app as a whole there. The module no longer needs it.
ELI5
Newer Nuxt servers have a slower fallback for old code, and they used it for Nuxt Content because of a few old-style imports and settings. The module now ships a small file for each server version and picks the right one. New servers run it directly, and older ones work as before.
🤖 Generated with Amp, reviewed by @larbish before opening.
No actionable comments were generated in the recent review.
Walkthrough
The module now selects storage implementations and related type declarations by Nitro version. Its esbuild target and media middleware route also vary by Nitro version. The change adds Nuxt 4/Nitro 3 and Nuxt 5 fixtures, installs their dependencies in CI, and tests their prepare and build commands for specified warning codes.
Merge Risk: Minimal · up to 14886 · assessed changes only
Path filters excluded changed files. This rating applies only to the assessed changes.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the module avoids the Nitro v2 compatibility layer when running on Nitro 3. The changeset adds Nitro 3 aliases, moves composables to #content/server, and sets nitro.es…
Description check
The description explains the warnings (NUXT_B9001, NUXT_B9002, NUXT_B9003) and lists each code change: the storage alias, the v3 composables import, the nitro.esbuild gating, the media middleware rout…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the module avoids the Nitro v2 compatibility layer when running on Nitro 3. The changeset adds Nitro 3 aliases, moves composables to #content/server, and sets nitro.esbuild only on Nitro 2. The title is short, specific, and follows the conventional commit style.
Full details: Description check
Explanation
The description explains the warnings (NUXT_B9001, NUXT_B9002, NUXT_B9003) and lists each code change: the storage alias, the v3 composables import, the nitro.esbuild gating, the media middleware route, the generated aliases.d.ts types, and the new test. It also gives build evidence and notes on pinned fixtures. It matches the changeset closely.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Fix failing CI checks
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
nitro-storage.d.ts
Parsing error: Unexpected token module
src/module.ts
Parsing error: Unexpected token {
src/runtime/server/content.ts
Parsing error: Unexpected token CacheArtifact
1 others
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: c92fb343-017e-4145-8574-d80504bb2742
Commits
Reviewing files that changed from the base of the PR and between 50232f9 and 148863f.
Files ignored due to path filters: 2
test/fixtures/nuxt4-nitro3/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
test/fixtures/nuxt5/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 19
.github/workflows/ci.yml
nitro-storage.d.ts
src/module.ts
src/runtime/server/content.ts
src/runtime/server/internal/storage.legacy.ts
src/runtime/server/internal/storage.ts
src/runtime/v3/composables.server.ts
src/utils/templates.ts
test/fixtures/nuxt4-nitro3/app.vue
test/fixtures/nuxt4-nitro3/content/index.md
test/fixtures/nuxt4-nitro3/nuxt.config.ts
test/fixtures/nuxt4-nitro3/package.json
test/fixtures/nuxt4-nitro3/pnpm-workspace.yaml
test/fixtures/nuxt5/app.vue
test/fixtures/nuxt5/content/index.md
test/fixtures/nuxt5/nuxt.config.ts
test/fixtures/nuxt5/package.json
test/fixtures/nuxt5/pnpm-workspace.yaml
test/nitro3.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
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
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.
❓ Type of change
📚 Description
On Nitro 3 (Nuxt 5, or Nuxt 4 with
nitroand@nuxt/nitro-v3-serverinstalled), the module made Nuxt apply its Nitro v2 compatibility layer and warn about the module itself:NUXT_B9003: the module's server code importsnitropack/runtimeand#imports.NUXT_B9001: the module setsnitro.esbuild, which Nitro 3 ignores.NUXT_B9002, on Nuxt 4 only: the media middleware has noroute.What changed:
#content/storagealias.resolveServerVariantpoints it atnitro/storageon Nitro 3 and atnitropack/runtimeon Nitro 2.v3/composables.server.tsimportscontentfrom a#content/serveralias instead of#imports. Itsnuxt/serverimport is type-only, so it is stripped from dist and Nuxt flagged the file.nitro.esbuild: only set on Nitro 2. Nitro 3 already targetsesnext.route: '/**'on Nitro 3. Nitro 2 readsrouteas a prefix, so it still gets none there.content/aliases.d.tsdeclares both aliases for the app tsconfig.test/nitro3.test.tsrunsnuxt prepareandnuxt buildon two fixtures,nuxt5(pinned nightly) andnuxt4-nitro3. It fails onNUXT_B9001,NUXT_B9002orNUXT_B9003. Each fixture has its own lockfile, and CI installs both before vitest.Evidence
nuxt buildof the same app, with the publishedv4build (50232f9) as Before and this branch packed as After.Nuxt 5, Before:
Nuxt 5, After:
Nuxt 4.7 + Nitro 3, Before:
Nuxt 4.7 + Nitro 3, After:
nuxt prepareon Nuxt 5 prints the same B9001 and B9003 before, and nothing after. Withcontent/deleted, the production server still renders the page from the snapshot and serves a media file (200 image/png) on Nuxt 4.7 + Nitro 2, Nuxt 4.7 + Nitro 3 and Nuxt 5.test/nitro3.test.ts(both fixtures,prepareandbuild):Lint, prepack and typecheck pass, and the full vitest suite passes on Nuxt 4.7.
Notes
[email protected]and[email protected], so bump them by hand until both are released.src, so it can't catch a type-onlynuxt/serverimport being stripped from dist. That case was checked with a packed tarball.nitroLegacyby default on Nitro 3, so the layer stays on for the app as a whole there. The module no longer needs it.ELI5
Newer Nuxt servers have a slower fallback for old code, and they used it for Nuxt Content because of a few old-style imports and settings. The module now ships a small file for each server version and picks the right one. New servers run it directly, and older ones work as before.
🤖 Generated with Amp, reviewed by @larbish before opening.