Skip to content

Conversation

@fm96-dev
Copy link
Contributor

πŸ”— Linked issue

Resolves #3213

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

In my case, the issue was with #build/app.config, but it also impacts #imports and other Nuxt-related imports.
To fix this, augment the Vite configuration within the AppConfigPlugin for Vite/Vue projects.
This involves adding the @nuxt/ui dependency to the test.server.deps.inline option.

This step is necessary because Vitest skips transforming files inside the node_modules folder by default.
While the AppConfigPlugin itself was functioning correctly, the load hook wasn't being appliedβ€”preventing Vitest from loading the virtual module properly

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

…line` to handle virtual imports in vitest tests
@pkg-pr-new
Copy link

pkg-pr-new bot commented Apr 17, 2025

npm i https://pkg.pr.new/@nuxt/ui@3925

commit: f838435

@benjamincanac benjamincanac requested a review from danielroe April 17, 2025 19:13
@benjamincanac benjamincanac changed the title fix: vitest skipping nuxt imports transformations when using vue fix(vite): vitest skipping nuxt imports transformations Apr 18, 2025
Copy link
Member

@benjamincanac benjamincanac left a comment

Choose a reason for hiding this comment

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

Thanks! 😊

@benjamincanac benjamincanac merged commit c31bffa into nuxt:v3 Apr 18, 2025
5 checks passed
@benjamincanac benjamincanac added the v3 #1289 label Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3 #1289

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError when Setting Up Vitest

3 participants