Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent outcomes when resolving directories with special characters #17457

Open
7 tasks done
zisiszak opened this issue Jun 13, 2024 · 1 comment
Open
7 tasks done
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@zisiszak
Copy link

Describe the bug

I kept getting a failed to load config error on an old, archived repo. This repo was nested within a parent directory named old?, whose question mark turned out to be the cause of the error. Only problem is the error is not descriptive, even though a parent directory of old# does alert you that a hash might cause issues.

Renaming the parent directory is an easy fix, and so having a clear error/warning logged suggesting so would help add to an even better dev experience.

I only found three characters that caused that kind of behaviour: ?*\

Reproduction

https://github.com/zisiszak/vite-inconsistent-resolution-error-logging

Steps to reproduce

  1. Run cd old\?
  2. Run pnpm install (or whatever suits)
  3. Run pnpm test (shortcut for pnpm exec vite)

From there, cd into the old# dir and repeat for an example of expected behaviour.

System Info

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Max
    Memory: 1.78 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.13.1/bin/yarn
    npm: 10.5.2 - ~/.nvm/versions/node/v20.13.1/bin/npm
    pnpm: 9.1.1 - ~/Library/pnpm/pnpm
  Browsers:
    Brave Browser: 125.1.66.118
    Safari: 17.5
  npmPackages:
    vite: ^5.2.13 => 5.2.13

Used Package Manager

pnpm

Logs

No response

Validations

@bluwy
Copy link
Member

bluwy commented Jun 13, 2024

We do handle ?

if (path.includes('?')) {
badChars.push('?')
}

But seems like for ? the error happened while loading the config, which is too early as we only check the # and ? after the config is loaded. It's strange that # worked for the config, and not ? though. It would be good to check what's causing this.

Otherwise as a last resort we may have to move the bad chars check earlier, at the expense of disregarding the logLevel set in the Vite config.

@bluwy bluwy added p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

2 participants