Skip to content

# character when installing from Git is incompatible with Vite #8437

@benmccann

Description

@benmccann

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

9.7.1

Which area(s) of pnpm are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

No response

Reproduction steps

Install from Git repository in a Vite project

In my case, I ran pnpm add -D "github:sveltejs/svelte#path:packages/svelte&sibling-dce" followed by pnpm build on https://github.com/benmccann/interactive-blogs-benchmark/tree/upgrade/sveltekit_mdsvex because I wanted to test out an in-progress PR to the Svelte repo and got:

[vite]: Rollup failed to resolve import "esm-env" from "node_modules/.pnpm/svelte@https+++codeload.github.com+sveltejs+svelte+tar.gz+155775a7acf51673ebb1b74dd87e65185e55bba0#path+packages+svelte/node_modules/svelte/src/internal/server/index.js".

Describe the Bug

It is not valid for an npm package name to contain # (source), but when you install from git it writes a package to the file system using # in the package name

There is an issue for this in the Vite repo (vitejs/vite#17459), but I'm not sure it could be considered a Vite issue since # isn't a valid character in a package name. It's quite fundamental to the way that Vite works and extremely difficult to change there

Expected Behavior

Would it be possible to encode # on the filesystem somehow? E.g. I notice that https:// is changed to https+++. It would be nice if we could also handle # as being a special character

Which Node.js version are you using?

20.13.1

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions