Skip to content

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

Merged
danielroe merged 2 commits into
nuxt:mainfrom
yamachi4416:fix-config-exclude-aliased-mocks-optimize-in-browser
Sep 30, 2026
Merged

danielroe merged 2 commits 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: 2fa4d4b

@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 in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 11da0709-7b56-4aa8-950f-e44014cc3d33

📥 Commits

Reviewing files that changed from the base of the PR and between 4d86f1f and 2fa4d4b.

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

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain 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 2fa4d

Vitest 5+ browser runs now exclude both Vue DevTools packages without replacing configured exclusions. No actionable merge-blocking risk remains.

🚥 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 dependency optimization in browser mode.
Description check ✅ Passed The description explains the Vitest 5 browser-mode issue, its conditions, the resulting errors, and the proposed fix. It is directly related to the changeset.
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 a new PR

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/config.ts

Parsing error: Unexpected token {


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.

@danielroe
danielroe enabled auto-merge September 30, 2026 11:08
@danielroe
danielroe added this pull request to the merge queue Sep 30, 2026
Merged via the queue into nuxt:main with commit 76be5bf Sep 30, 2026
10 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 30, 2026
@yamachi4416
yamachi4416 deleted the fix-config-exclude-aliased-mocks-optimize-in-browser branch September 30, 2026 21:44
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