Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: This module cannot be imported in the Vue part of your app #747

Open
AlbertBrand opened this issue Jan 30, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@AlbertBrand
Copy link
Contributor

AlbertBrand commented Jan 30, 2024

Environment

  • Operating System: Linux
  • Node Version: v18.18.0
  • Nuxt Version: 3.9.3
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: npm@10.2.3
  • Builder: -
  • User Config: devtools, modules
  • Runtime Modules: @nuxt/test-utils/module@3.11.0
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-3etpwp?file=package.json

Describe the bug

If you have test files in your pages folder importing @nuxt/test-utils/runtime, the following error pops up when starting the project

ERROR  This module cannot be imported in the Vue part of your app. [importing @nuxt/test-utils/runtime from pages/<testname>.ts]

The error does not seem to have effect on the app startup itself (it's probably more a warning).

The error goes away when moving the test out of the pages folder.

Additional context

No response

Logs

No response

@wattanx
Copy link
Contributor

wattanx commented Feb 1, 2024

It seems that .nuxtignore can be used to avoid this.
https://nuxt.com/docs/guide/directory-structure/nuxtignore

// .nuxtignore
pages/*.nuxt.spec.ts

@danielroe danielroe added bug Something isn't working and removed pending triage labels Mar 22, 2024 — with Volta.net
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants