Skip to content

Dependency scan fails with incorrect file path when input contains @ in directory name on Windows #23383

Description

@zheung

Describe the bug

When using a multi‑page configuration with input (not rolldownOptions.input), I always get a dependency scan error. The full error message is:

PS D:\desk\test-vite-scan\test> pnpm exec vite --force --host
dirPackage D:\desk\test-vite-scan\test
fileHTML   D:\desk\test-vite-scan\test\@src\whatever.html
14:19:27 [vite] (client) Forced re-optimization of dependencies

  VITE v8.2.2  ready in 195 ms

  ➜  Local:   http://localhost:5173/
  ➜  press h + enter to show help
(!) Failed to run dependency scan. Skipping dependency pre-bundling. Error: failed to resolve rolldownOptions.input value: "D:\\desk\\test-vite-scan\\test@src\\whatever.html".
    at resolvePath (file:///D:/desk/test-vite-scan/test/node_modules/.pnpm/vite@8.2.2/node_modules/vite/dist/node/chunks/node.js:31472:29)
    at async Promise.all (index 0)
    at async computeEntries (file:///D:/desk/test-vite-scan/test/node_modules/.pnpm/vite@8.2.2/node_modules/vite/dist/node/chunks/node.js:31477:41)
    at async scan (file:///D:/desk/test-vite-scan/test/node_modules/.pnpm/vite@8.2.2/node_modules/vite/dist/node/chunks/node.js:31420:19)
    at async file:///D:/desk/test-vite-scan/test/node_modules/.pnpm/vite@8.2.2/node_modules/vite/dist/node/chunks/node.js:34462:15
  1. I do not set rolldownOptions.input anywhere in my config – I only set the standard input option.

  2. The reported path is incorrect: it shows test@src (without a backslash between test and @src), but my actual directory structure is test\@src. The correct full path should be D:\desk\test-vite-scan\test\@src\whatever.html.

    I did further testing and found that any directory name that starts with @ at any level above the project root triggers this same error. For example, if my project is inside D:\some\@project\my-app, the error will show a malformed path missing the backslash before @project.

  3. My OS is Windows 11. This issue cannot be reproduced on StackBlitz.

  4. Even if my HTML file doesn't import any JavaScript files, this error still occurs.

vite.config.js

import { dirname, resolve } from 'path';
import { fileURLToPath } from 'url';

import { defineConfig } from 'vite';



const dirPackage = dirname(fileURLToPath(import.meta.url));
const fileHTML = resolve(dirPackage, '@src', 'whatever.html');

console.log('dirPackage', dirPackage);
console.log('fileHTML  ', fileHTML);

export default defineConfig(() => {
	return {
		input: {
			whatever: fileHTML,
		},
	};
});

screenshot

Image

Reproduction

https://stackblitz.com/edit/vitejs-vite-kicw9xc5?file=vite.config.js

Steps to reproduce

No response

System Info

System:
    OS: Windows 11 10.0.26200
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor             
    Memory: 37.64 GB / 63.92 GB
  Binaries:
    Node: 26.8.1 - e:\runtime\node\node.EXE
    npm: 11.19.0 - e:\runtime\node\npm.CMD
    pnpm: 12.0.0 - C:\Users\zheung\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Chrome: 151.0.7922.174
    Edge: Chromium (146.0.3856.62)
    Firefox: 145.0.2 - C:\Program Files\Mozilla Firefox\firefox.exe
  npmPackages:
    vite: ^8.2.2 => 8.2.2

Used Package Manager

pnpm

Logs

No response

Validations

Activity

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

    p3-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