Skip to content

fix(config): exclude aliased mock packages from optimizeDeps in browser mode - #1816

Open
yamachi4416 wants to merge 1 commit into
nuxt:mainfrom
yamachi4416:fix-config-exclude-aliased-mocks-optimize-in-browser
Open

yamachi4416 wants to merge 1 commit into
nuxt:mainfrom
yamachi4416:fix-config-exclude-aliased-mocks-optimize-in-browser

Conversation

@yamachi4416

@yamachi4416 yamachi4416 commented Sep 9, 2026

Copy link
Copy Markdown
Member

🔗 Linked issue

📚 Description

When packages using dependencies aliased to mocks are added to optimizeDeps.include (following nuxt dev optimize hint), it triggers runtime re-bundling and causes errors in vitest5 browser mode. (this occurs when vite cache is not present, such as in ci).

Reproduction

before: https://stackblitz.com/edit/nuxt-test-utils-pr-1816-before?file=package.json
after: https://stackblitz.com/edit/nuxt-test-utils-pr-1816-after?file=package.json

@pkg-pr-new

pkg-pr-new Bot commented Sep 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/test-utils@1816
npm i https://pkg.pr.new/vitest-environment-nuxt@1816

commit: 4d86f1f

@yamachi4416 yamachi4416 changed the title fix(config): exclude aliased mock packages from optimizeDeps in brows… fix(config): exclude aliased mock packages from optimizeDeps in browser mode Sep 9, 2026
@yamachi4416
yamachi4416 marked this pull request as ready for review September 9, 2026 12:31
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: d6d009a7-0a97-46f6-8379-5de6f07f8020

📥 Commits

Reviewing files that changed from the base of the PR and between 517f137 and 4d86f1f.

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

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

When Vitest 5+ browser mode is enabled, resolveConfig initializes optimizeDeps.exclude and adds @vue/devtools-kit and @vue/devtools-core. This extends the existing dependency exclusions for mock-aliased packages.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 4d86f

Vitest 5+ browser mode now avoids pre-bundling the mock-aliased Vue DevTools packages, preventing browser-test dependency resolution failures without changing public APIs or non-browser behavior.

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. 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 clearly and concisely describes the main change: excluding aliased mock packages from Vite optimizeDeps in browser mode.
Description check ✅ Passed The description directly explains the Vitest 5 browser-mode issue, its CI-related trigger, and the purpose of the configuration change. It also provides reproductions.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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.

2 participants