Skip to content

Error No known conditions for "." specifier with vitest 3 #7277

@silverwind

Description

@silverwind

Describe the bug

Since vitest 3, I'm running into a new resolve error relateded to the @neodrag/react npm module. The exact same code worked with vitest 2.

Vite is able to resolve and build this module fine (npx vite build works), it fails only with vitest. Let me know if you suspect a bug in the module, its source is here.

 FAIL  index.test.js [ index.test.js ]
Error: Failed to resolve entry for package "@neodrag/react". The package may have incorrect main/module/exports specified in its package.json: No known conditions for "." specifier in "@neodrag/react" package
  Plugin: vite:import-analysis
  File: /Users/silverwind/git/vitest-resolve-bug/index.test.js:1:31
  1  |  import { useDraggable } from "@neodrag/react";

Reproduction

https://github.com/silverwind/vitest-resolve-bug

git clone https://github.com/silverwind/vitest-resolve-bug
cd vitest-resolve-bug
npm install
npx vitest

System Info

System:
    OS: macOS 15.2
    CPU: (16) arm64 Apple M3 Max
    Memory: 9.96 GB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.6.0 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.9.2 - /opt/homebrew/bin/npm
    pnpm: 9.15.4 - ~/.npm-global/bin/pnpm
    bun: 1.1.43 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 132.0.6834.84
    Firefox Nightly: 129.0a1
    Safari: 18.2
  npmPackages:
    vitest: 3.0.1 => 3.0.1

Used Package Manager

npm

Validations

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