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

Fail to load packages installed from Git repo #17459

Open
7 tasks done
kong-dev opened this issue Jun 13, 2024 · 3 comments
Open
7 tasks done

Fail to load packages installed from Git repo #17459

kong-dev opened this issue Jun 13, 2024 · 3 comments
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@kong-dev
Copy link

Describe the bug

Since upgrading to pnpm v9, Vite has failed to load packages installed from Git repo.

Error like this
  vite:load 5.98ms [fs] /main.js +0ms
  vite:resolve 6.61ms uuid-mirror -> /Users/kongdev/Workspace/demo/vite-issue/node_modules/.pnpm/uuid@git+https+++gitee.com+kongdev+uuid.git#da189d1792993d0da4b5008ea98c5ef48896739c/node_modules/uuid/dist/esm-browser/index.js +29ms
  vite:import-analysis 15.07ms [1 imports rewritten] main.js +0ms
  vite:transform 24.05ms /main.js +0ms
3:06:02 PM [vite] Pre-transform error: Failed to load url /node_modules/.pnpm/uuid@git+https+++gitee.com+kongdev+uuid.git?import#da189d1792993d0da4b5008ea98c5ef48896739c/node_modules/uuid/dist/esm-browser/index.js (resolved id: /Users//kongdev/Workspace/demo/vite-issue/node_modules/.pnpm/uuid@git+https+++gitee.com+kongdev+uuid.git#da189d1792993d0da4b5008ea98c5ef48896739c/node_modules/uuid/dist/esm-browser/index.js) in /Users//kongdev/Workspace/demo/vite-issue/main.js. Does the file exist?

Repos on Github or Gitlab exhibit no issues, yet those on self-hosted services or other Git providers encounter problems.

It seems there is # in the file path that may be causing the issue. logic here

Reproduction

https://github.com/kong-dev/vite-issue

Steps to reproduce

The repository above is a minimal reproduction including 2 dependencies:

  • 'uuid' from the npm registry
  • 'uuid-mirror' from the mirrored Git repo

Steps:

  • Install pnpm v9
  • Clone the repo above
  • Run pnpm install
  • Start the dev server by running pnpm run dev
  • Access in the browser

System Info

System:
    OS: macOS 14.5
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 418.56 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.14.0 - ~/.nvm/versions/node/v20.14.0/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v20.14.0/bin/npm
    pnpm: 9.3.0 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 126.0.6478.57
    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

Yeah it's likely that the # is messing with the resolving. We perhaps miss an edgecase with this, but it's hard and less-performant to resolve with #.

@bluwy bluwy added p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Jun 13, 2024
@brachkow
Copy link

brachkow commented Jun 15, 2024

Same issue there. I don't thinks that is very «edgecase» stuff. In small-to-medium projects it is much easier to use git, then private packages, which are coming with overhead from publish flow of public packages.

@juanjiejie
Copy link

Same issue

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

4 participants