Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix(schema): enable HMR for defineNuxtComponent in JSX - #35620

#35620
Merged
danielroe merged 2 commits into
mainnuxt/nuxt:mainfrom
fix/tsx-defineNuxtComponent-hmrnuxt/nuxt:fix/tsx-defineNuxtComponent-hmrCopy head branch name to clipboard
Jul 17, 2026
Merged

fix(schema): enable HMR for defineNuxtComponent in JSX#35620
danielroe merged 2 commits into
mainnuxt/nuxt:mainfrom
fix/tsx-defineNuxtComponent-hmrnuxt/nuxt:fix/tsx-defineNuxtComponent-hmrCopy head branch name to clipboard

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

resolves #35465

📚 Description

this adds defineNuxtComponent to the list of component factories with HMR

@danielroe
danielroe requested a review from huang-julien July 17, 2026 11:29
@danielroe
danielroe enabled auto-merge July 17, 2026 11:29
@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: 1

🤖 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/schema/src/config/vite.ts`:
- Around line 74-78: Update the returned options object in the Vite
configuration flow to spread options before assigning the enforced
isCustomElement and defineComponentName fields. Preserve the compiler-derived
isCustomElement handler and ensure defineComponentName always includes
defineNuxtComponent, even when user options provide overrides.
🪄 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: f8cc5cfb-d271-46d3-b9fd-7685ff9620fd

📥 Commits

Reviewing files that changed from the base of the PR and between 4105905 and 967838d.

📒 Files selected for processing (1)
  • packages/schema/src/config/vite.ts

Comment on lines 74 to +78
return {
// TODO: investigate type divergence between types for @vue/compiler-core and @vue/babel-plugin-jsx
isCustomElement: (await get('vue')).compilerOptions?.isCustomElement as undefined | ((tag: string) => boolean),
...typeof val === 'object' ? val : {},
defineComponentName: [...new Set([...options.defineComponentName ?? ['defineComponent'], 'defineNuxtComponent'])],
...options,

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Apply enforced options after spreading user options.

...options on Line 78 overwrites both values calculated above. A configured defineComponentName can therefore omit defineNuxtComponent, and a configured isCustomElement can replace the compiler-derived handler. Spread options first, then assign these enforced fields.

Proposed fix
         return {
+          ...options,
           // TODO: investigate type divergence between types for `@vue/compiler-core` and `@vue/babel-plugin-jsx`
           isCustomElement: (await get('vue')).compilerOptions?.isCustomElement as undefined | ((tag: string) => boolean),
           defineComponentName: [...new Set([...options.defineComponentName ?? ['defineComponent'], 'defineNuxtComponent'])],
-          ...options,
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return {
// TODO: investigate type divergence between types for @vue/compiler-core and @vue/babel-plugin-jsx
isCustomElement: (await get('vue')).compilerOptions?.isCustomElement as undefined | ((tag: string) => boolean),
...typeof val === 'object' ? val : {},
defineComponentName: [...new Set([...options.defineComponentName ?? ['defineComponent'], 'defineNuxtComponent'])],
...options,
return {
...options,
// TODO: investigate type divergence between types for `@vue/compiler-core` and `@vue/babel-plugin-jsx`
isCustomElement: (await get('vue')).compilerOptions?.isCustomElement as undefined | ((tag: string) => boolean),
defineComponentName: [...new Set([...options.defineComponentName ?? ['defineComponent'], 'defineNuxtComponent'])],
}
🤖 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/schema/src/config/vite.ts` around lines 74 - 78, Update the returned
options object in the Vite configuration flow to spread options before assigning
the enforced isCustomElement and defineComponentName fields. Preserve the
compiler-derived isCustomElement handler and ensure defineComponentName always
includes defineNuxtComponent, even when user options provide overrides.

@github-actions github-actions Bot added 5.x 🐛 bug Something isn't working as expected labels Jul 17, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@nuxt/kit

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

@nuxt/nitro-server

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

nuxt

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

@nuxt/rspack-builder

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

@nuxt/schema

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

@nuxt/vite-builder

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

@nuxt/webpack-builder

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

commit: f0cd8db

@codspeed-hq

codspeed-hq Bot commented Jul 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 21 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing fix/tsx-defineNuxtComponent-hmr (f0cd8db) with main (4105905)

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 added this pull request to the merge queue Jul 17, 2026
Merged via the queue into main with commit f436322 Jul 17, 2026
30 checks passed
@danielroe
danielroe deleted the fix/tsx-defineNuxtComponent-hmr branch July 17, 2026 12:48
@github-actions github-actions Bot mentioned this pull request Jul 17, 2026
5 tasks
@github-actions github-actions Bot mentioned this pull request Jul 17, 2026
This was referenced Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5.x 🐛 bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HMR not working for .tsx pages using defineNuxtComponent

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.