Skip to content

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

@AlbertBrand

Description

@AlbertBrand

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: [email protected]
  • Builder: -
  • User Config: devtools, modules
  • Runtime Modules: @nuxt/test-utils/[email protected]
  • 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions