Skip to content

Conversation

@KazariEX
Copy link
Member

🔗 Linked issue

📚 Description

This avoid duplicate generation of client only components like NuxtRouteAnnouncer.

@KazariEX KazariEX requested a review from danielroe as a code owner September 28, 2025 16:14
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 28, 2025

Open in StackBlitz

@nuxt/kit

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

nuxt

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

@nuxt/rspack-builder

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

@nuxt/schema

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

@nuxt/vite-builder

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

@nuxt/webpack-builder

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

commit: 705831c

@coderabbitai
Copy link

coderabbitai bot commented Sep 28, 2025

Walkthrough

resolveComponentTypes in packages/nuxt/src/components/templates.ts was changed to skip island components early and only compute types for non-island components. Per-component type strings are rebuilt (including path normalisation and export keys). Server-side logic was adjusted: server-mode components are skipped when a client counterpart exists and the server file path uses the server placeholder; when no client counterpart exists the computed type is wrapped in IslandComponent<...>. The previous isServerOnly branch was removed and all pushes of [pascalName, type] are done via a single unified path.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly describes the main fix introduced by the pull request, namely preventing the generation of server placeholder components, which directly corresponds to the changes in the resolveComponentTypes logic outlined in the diff.
Description Check ✅ Passed The description concisely explains that the pull request prevents duplicate client-only components such as NuxtRouteAnnouncer, which directly relates to the implemented change of skipping server placeholder components.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 46beb88 and 705831c.

📒 Files selected for processing (1)
  • packages/nuxt/src/components/templates.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/nuxt/src/components/templates.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: huang-julien
PR: nuxt/nuxt#29366
File: packages/nuxt/src/app/components/nuxt-root.vue:16-19
Timestamp: 2024-12-12T12:36:34.871Z
Learning: In `packages/nuxt/src/app/components/nuxt-root.vue`, when optimizing bundle size by conditionally importing components based on route metadata, prefer using inline conditional imports like:

```js
const IsolatedPage = route?.meta?.isolate ? defineAsyncComponent(() => import('#build/isolated-page.mjs')) : null
```

instead of wrapping the import in a computed property or importing the component unconditionally.
Learnt from: GalacticHypernova
PR: nuxt/nuxt#26468
File: packages/nuxt/src/components/plugins/loader.ts:24-24
Timestamp: 2024-11-05T15:22:54.759Z
Learning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: code
🔇 Additional comments (1)
packages/nuxt/src/components/templates.ts (1)

127-130: Avoid dropping legitimately named server components.

Using startsWith means any user-created server component whose path begins with server-placeholder (for example, components/server-placeholder-modal.server.vue) will now get filtered out along with the actual placeholder, so its declaration never lands in the generated d.ts. Please normalise the filename and perform an exact comparison instead of a prefix test.

-        if (c.filePath.startsWith(serverPlaceholderPath)) {
+        if (c.filePath.replace(NON_VUE_RE, '') === serverPlaceholderPath) {
           continue
         }

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57a965f and 46beb88.

📒 Files selected for processing (1)
  • packages/nuxt/src/components/templates.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/nuxt/src/components/templates.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: test-fixtures (ubuntu-latest, built, webpack, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, webpack, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite, default, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, async, manifest-on, js, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, default, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, rspack, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, default, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-on, js, lts/-1)
  • GitHub Check: release-pkg-pr-new
  • GitHub Check: test-benchmark
  • GitHub Check: typecheck (windows-latest, bundler)
  • GitHub Check: typecheck (ubuntu-latest, bundler)

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 28, 2025

CodSpeed Performance Report

Merging #33345 will not alter performance

Comparing KazariEX:fix/server-placeholder-component (705831c) with main (57a965f)

Summary

✅ 10 untouched

@danielroe danielroe merged commit 339d0b5 into nuxt:main Sep 29, 2025
81 of 84 checks passed
@KazariEX KazariEX deleted the fix/server-placeholder-component branch September 29, 2025 08:50
@github-actions github-actions bot mentioned this pull request Sep 29, 2025
@github-actions github-actions bot mentioned this pull request Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants