Skip to content

Import conditions not respected on main thread #7588

@mrginglymus

Description

@mrginglymus

Describe the bug

Following from https://discord.com/channels/917386801235247114/1344949468579233805

If you have custom import conditions in a workspace package where the default points to a file that does not exist (say, a ./dist/file.js), and import conditions in the parent package, then running vitest with coverage and all will fail.

I'm not sure of the exact path towards the error, but the significant area appears to be that vite's resolveSubpathImports is called without the conditions specified in vitest config.

Reproduction

https://github.com/mrginglymus/vitest-coverage-import

System Info

-

Used Package Manager

yarn

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: browserIssues and PRs related to the browser runnerfeat: coverageIssues and PRs related to the coverage featurep3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions