Skip to content

Error when loading browser-entry.mjs: Syntax error, "qs" does not provide an export named "default" #1388

@andreaswolf

Description

@andreaswolf

Environment

  • Operating System: Linux
  • Node Version: v20.19.4
  • Nuxt Version: 3.18.1
  • CLI Version: 3.27.0
  • Nitro Version: 2.12.4
  • Package Manager: yarn@4.2.2
  • Builder: -
  • User Config: devtools, modules, ui, colorMode, css, formkit, pinia, components, ssr, typo3
  • Runtime Modules: @nuxt/ui@3.3.0, @pinia/nuxt@0.11.2, @t3headless/nuxt-typo3@2.2.1, @formkit/nuxt@1.6.9, @nuxtjs/storybook@9.0.0, @nuxt/test-utils/module@3.19.2, nuxt-viewport@2.3.1
  • Build Modules: -

Reproduction

See https://github.com/andreaswolf/nuxt-issue-repro

Run yarn run vitest --project=e2e for a working test, yarn run vitest --project=e2e-nuxt will not work.

Describe the bug

Tests run fine without Nuxt/defineVitestProject. As soon as I use defineVitestProject(), there are two errors and the tests are not run anymore:

  1. Error: Failed to import test file /home/aw/Kunden/fes/fes-cp-v11/frontend-v2/node_modules/@nuxt/test-utils/dist/runtime/browser-entry.mjs
    Caused by: SyntaxError: The requested module '/node_modules/qs/lib/index.js?v=c5ced9fb' does not provide an export named 'default'

  2. TypeError: Cannot set properties of undefined (setting 'PROD')

The second issue (very likely) comes from setupEnv in vitest's setup-common.js. I can also open a separate issue for this.

Additional context

No response

Logs

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