Skip to content

SyntaxError: The requested module '.../node_modules/vitest/dist/reporters.js' does not provide an export named 'BaseReporter' #8523

@mike-lischke

Description

@mike-lischke

Describe the bug

Vitest throws an error when importing the BaseReporter

Reproduction

I followed the example for creating a custom reporter using the BaseReporter class. When I launch vitest to execute my tests I get an exception in the startup code:

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Startup Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
file:///.../node_modules/.vite-temp/vitest.config.ts.timestamp-1756886635565-a568271006c23.mjs:10
import { BaseReporter } from "file:///.../node_modules/vitest/dist/reporters.js";
^^^^^^^^^^^^
SyntaxError: The requested module 'file:///.../node_modules/vitest/dist/reporters.js' does not provide an export named 'BaseReporter'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:220:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:321:5)
at async onImport.tracePromise.proto (node:internal/modules/esm/loader:644:26)
at async loadConfigFromBundledFile (file:///.../node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:49416:15)
at async bundleAndLoadConfigFile (file:///.../node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:49259:22)
at async loadConfigFromFile (file:///.../node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:49222:44)
at async resolveConfig (file:///.../node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:48718:24)
at async _createServer (file:///.../node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:38329:18)
at async createViteServer (file:///.../node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:6911:17)
at async createVitest (file:///.../node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:10202:17)

System Info

System:
    OS: macOS 15.6.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 336.05 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.17.0 - ~/.nvm/versions/node/v22.17.0/bin/node
    Yarn: 1.22.15 - /usr/local/bin/yarn
    npm: 10.9.2 - ~/.nvm/versions/node/v22.17.0/bin/npm
    pnpm: 8.15.4 - /opt/homebrew/bin/pnpm
  Browsers:
    Brave Browser: 139.1.81.137
    Chrome: 139.0.7258.155
    Safari: 18.6

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions