Skip to content

Cannot import a file with "$$" in the name with package.json imports in the dev server #23637

Closed

Description

@Pinpickle

Describe the bug

When a package uses wildcard subpath imports/exports (e.g. "#*": "./src/*"), the string "$$" gets replaced with "$" (likely because of some string substitution logic treating "$$" as something special).

Those imports are broken in dev - but they do work on a full build!

Reproduction

https://stackblitz.com/edit/vitejs-vite-uaefh2k8?file=src%2Fmain.js

Steps to reproduce

  1. package.json: { "type": "module", "imports": { "#*": "./src/*" } }
  2. Create src/test$$.js with export {};
  3. In src/main.js: import "#test$$.js"; console.log("Hello");
  4. Run vite (dev) and load the page: Failed to resolve import "#test$$.js", because it looks for src/test$.js
  5. Run vite build: resolves correctly. Importing "./test$$.js" in dev works. As does importing "#test.js" (if the file exists).

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 22.22.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    vite: ^8.3.1 => 8.3.2

Used Package Manager

npm

Logs

[plugin:vite:import-analysis] Failed to resolve import "#test$$.js" from "src/main.js". Does the file exist?

Validations

Activity

  1. added theissue type on Oct 3, 2026
  2. btea commented on Oct 8, 2026

    @btea
    Contributor

    The issue has been fixed in resolve.exports lukeed/resolve.exports#44, awaiting the release of a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: upstreamBug in a dependency of Vite

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions