Skip to content

fix(devtools): pre-bundle additional injected client deps in dev#991

Merged
antfu merged 1 commit intomainfrom
antfu/prebundle-client-deps
May 1, 2026
Merged

fix(devtools): pre-bundle additional injected client deps in dev#991
antfu merged 1 commit intomainfrom
antfu/prebundle-client-deps

Conversation

@antfu
Copy link
Copy Markdown
Member

@antfu antfu commented May 1, 2026

Summary

Extends the existing dev optimizeDeps.include block in module-main.ts so Vite stops triggering a page reload when it discovers the deps imported by the injected runtime client plugins. Adds @vitejs/devtools/client/inject, @vitejs/devtools-kit/client, error-stack-parser-es, and vite-plugin-vue-tracer/client/overlay to the list that already had @vue/devtools-kit and @vue/devtools-core (originally added under #980/#981). All four are already direct deps of @nuxt/devtools.

Test plan

  • pnpm -C playgrounds/empty exec nuxt dev — confirm the "Pre-bundle them in your nuxt.config.ts" warning listing those packages no longer appears
  • Same check for playgrounds/tab-pinia and playgrounds/tab-seo
  • e2e suite still passes

🤖 Generated with Claude Code

Extend the dev optimizeDeps.include list so Vite doesn't trigger a page
reload when discovering deps imported by the runtime client plugins:
`@vitejs/devtools/client/inject`, `@vitejs/devtools-kit/client`,
`error-stack-parser-es`, and `vite-plugin-vue-tracer/client/overlay`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying nuxt-devtools with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4d08ebc
Status: ✅  Deploy successful!
Preview URL: https://f8946834.nuxt-devtools.pages.dev
Branch Preview URL: https://antfu-prebundle-client-deps.nuxt-devtools.pages.dev

View logs

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4cd1f3e9-8b82-4d76-ba45-a7be45802d52

📥 Commits

Reviewing files that changed from the base of the PR and between bb3fef8 and 4d08ebc.

📒 Files selected for processing (1)
  • packages/devtools/src/module-main.ts

📝 Walkthrough

Walkthrough

The module-main.ts file has been updated to include additional packages in Vite's dependency pre-bundling configuration during dev mode. The change expands the nuxt.options.vite.optimizeDeps.include array to incorporate Vite DevTools client inject/kit client, error-stack-parser-es, and the Vue tracer overlay client, beyond the previously included @vue/devtools-kit and @vue/devtools-core. The implementation refactors the code by consolidating separate push operations into a single batched call.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding additional dependencies to Vite's pre-bundling configuration in devtools.
Description check ✅ Passed The description provides clear context about the change, explains why it's needed (to prevent Vite reloads), lists the dependencies being added, and includes a test plan.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch antfu/prebundle-client-deps

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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

@antfu antfu merged commit 481947a into main May 1, 2026
8 checks passed
@antfu antfu deleted the antfu/prebundle-client-deps branch May 1, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant