Skip to content

[Bug]: Jest does not correctly resolve wildcards in subpath imports #15250

Closed
@JavaScriptBach

Description

@JavaScriptBach

Version

29.7.0

Steps to reproduce

See https://github.com/JavaScriptBach/jest-repro

Expected behavior

When a subpath import with a wildcard is defined, Jest does not correctly resolve it.

For example, if I define

"imports": {
    "#test/*.css": "./src/*.css",
    "#test/*.ts": "./src/*.ts"
},

Then an import of #test/asdf/css.ts should resolve to ./src/asdf/css.ts.

Actual behavior

Instead, Jest resolves it to ./src/asdf.css.

Additional context

My envinfo below is macOS, but this issue also happens on Linux.

Environment

System:
    OS: macOS 14.6
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 18.14.0 - ~/.nvm/versions/node/v18.14.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.14.0/bin/yarn
    npm: 9.3.1 - ~/.nvm/versions/node/v18.14.0/bin/npm
    pnpm: 9.7.0 - ~/.nvm/versions/node/v18.14.0/bin/pnpm

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