Skip to content

feat(kit,nitro,nuxt,schema,vite,webpack): nuxt/* build output contract - #35463

Merged
danielroe merged 5 commits into
mainfrom
feat/build-outputs
Jul 13, 2026
Merged

danielroe merged 5 commits into
mainfrom
feat/build-outputs

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

📚 Description

this is a step towards the vite environment api by finalising a contract between builders and nuxt itself

relevant for #35364

@github-actions github-actions Bot added the 5.x label Jun 27, 2026
@danielroe danielroe changed the title Feat/build outputs feat(kit,nitro,nuxt,schema,vite,webpack): nuxt/* build output contract Jun 27, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jun 27, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@35463

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@35463

nuxt

npm i https://pkg.pr.new/nuxt@35463

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@35463

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@35463

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@35463

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@35463

commit: 0529485

@danielroe
danielroe force-pushed the feat/build-outputs branch from db22308 to 829c1b9 Compare June 27, 2026 22:03
@coderabbitai

This comment has been minimized.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
packages/nitro-server/src/legacy.ts (1)

23-28: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Publish the dev server entry through buildOutputs.

Line 27 bypasses the new NuxtBuildOutputs contract by overriding nitro.options.virtual directly. Registering serverEntry keeps webpack/rspack dev aligned with the NUXT_BUILD_OUTPUT_MAP path used by Nitro.

Proposed change
-import { logger } from '`@nuxt/kit`'
+import { logger, setBuildOutput } from '`@nuxt/kit`'
@@
         if (name === 'server') {
           const memfs = compiler.outputFileSystem as typeof import('node:fs')
-          nitro.options.virtual['nuxt/entry'] = () => memfs.readFileSync(join(nuxt.options.buildDir, 'dist/server/server.mjs'), 'utf-8')
+          setBuildOutput(nuxt, 'serverEntry', () => memfs.readFileSync(join(nuxt.options.buildDir, 'dist/server/server.mjs'), 'utf-8'))
         }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/nitro-server/src/legacy.ts` around lines 23 - 28, The dev server
entry is being injected by mutating nitro.options.virtual directly in the legacy
builder hook, which bypasses the NuxtBuildOutputs contract. Update the builder
logic in legacy.ts so the server entry is registered through buildOutputs as
serverEntry instead of setting nitro.options.virtual['nuxt/entry'], keeping the
webpack/rspack path aligned with the NUXT_BUILD_OUTPUT_MAP/Nitro flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/nitro-server/src/runtime/utils/renderer/build-files.ts`:
- Around line 34-36: The getPrecomputedDependencies loader is incorrectly using
a fallback that treats an undefined default export from nuxt/precomputed as
missing, which can pass the module namespace into createRenderer instead of
preserving no precomputed data. Update getPrecomputedDependencies in
build-files.ts to only use the default export when it is actually present, while
still allowing an explicit undefined result to flow through unchanged; keep the
function’s return behavior consistent for both function and value exports.

In `@packages/nuxt/src/core/nuxt.ts`:
- Line 85: The fallback serverEntry in nuxt.ts currently returns a no-op module,
which hides the intended builder-misconfiguration failure. Update the
serverEntry fallback to fail fast by reusing the same explicit error behavior as
the runtime server entry in packages/nuxt/src/runtime/server/entry.ts, so
missing nuxt.buildOutputs publishing surfaces the “[nuxt] nuxt/entry was not
replaced...” message. Use the serverEntry symbol in Nuxt config to locate and
replace the current placeholder implementation with an error-throwing or
error-emitting entry.

In `@packages/schema/src/types/nuxt.ts`:
- Around line 99-100: The `ssrStyles` value in the Nuxt schema is being
re-exported as a raw path, which can break ESM imports when it is an absolute
Windows path. Update the handling around `ssrStyles` in the Nuxt
virtual-module/export flow so it is normalized before being interpolated into
`export { default } from ...`; use the existing `ssrStyles` symbol to locate the
boundary where the specifier is formed and convert absolute paths to a `file://`
URL or equivalent normalized form.

---

Nitpick comments:
In `@packages/nitro-server/src/legacy.ts`:
- Around line 23-28: The dev server entry is being injected by mutating
nitro.options.virtual directly in the legacy builder hook, which bypasses the
NuxtBuildOutputs contract. Update the builder logic in legacy.ts so the server
entry is registered through buildOutputs as serverEntry instead of setting
nitro.options.virtual['nuxt/entry'], keeping the webpack/rspack path aligned
with the NUXT_BUILD_OUTPUT_MAP/Nitro flow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 24e85b56-6d94-45de-ad0f-cd2487f54df5

📥 Commits

Reviewing files that changed from the base of the PR and between 369a6c6 and db22308.

⛔ Files ignored due to path filters (1)
  • packages/nuxt/package.json is excluded by !**/package.json
📒 Files selected for processing (26)
  • packages/kit/src/build.ts
  • packages/kit/src/index.ts
  • packages/nitro-server/src/index.ts
  • packages/nitro-server/src/legacy.ts
  • packages/nitro-server/src/runtime/handlers/renderer.ts
  • packages/nitro-server/src/runtime/utils/renderer/build-files.ts
  • packages/nitro-server/src/runtime/utils/renderer/cache.ts
  • packages/nuxt/src/core/nuxt.ts
  • packages/nuxt/src/runtime/server/entry-chunk.ts
  • packages/nuxt/src/runtime/server/entry-ids.ts
  • packages/nuxt/src/runtime/server/entry.ts
  • packages/nuxt/src/runtime/server/manifest.ts
  • packages/nuxt/src/runtime/server/precomputed.ts
  • packages/nuxt/src/runtime/server/styles.ts
  • packages/nuxt/tsdown.config.ts
  • packages/schema/src/index.ts
  • packages/schema/src/types/nuxt.ts
  • packages/vite/src/plugins/client-manifest.ts
  • packages/vite/src/plugins/server-entry.ts
  • packages/vite/src/plugins/ssr-styles.ts
  • packages/vite/src/plugins/stable-entry.ts
  • packages/vite/src/plugins/vite-node.ts
  • packages/vite/src/vite.ts
  • packages/webpack/src/plugins/ssr-styles.ts
  • packages/webpack/src/plugins/vue/client.ts
  • packages/webpack/src/webpack.ts

Comment thread packages/nuxt/src/core/nuxt.ts Resolved
Comment thread packages/schema/src/types/nuxt.ts Resolved
@codspeed

codspeed Bot commented Jun 27, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 21 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing feat/build-outputs (0529485) with main (14495bd)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@danielroe
danielroe merged commit 1dd55ee into main Jul 13, 2026
30 checks passed
@danielroe
danielroe deleted the feat/build-outputs branch July 13, 2026 14:07
@github-actions github-actions Bot mentioned this pull request Jul 13, 2026
2 of 5 tasks
@github-actions github-actions Bot mentioned this pull request Jul 17, 2026
@github-actions github-actions Bot mentioned this pull request Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant