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

Vite CLI Paths take the entire path of the PC instead of just the project's path #14750

Closed
7 tasks done
muchisx opened this issue Oct 25, 2023 · 4 comments
Closed
7 tasks done

Comments

@muchisx
Copy link

muchisx commented Oct 25, 2023

Describe the bug

This might be a Windows only thing (I posted the same issue in the Astro Repo and they already fixed it #8831)
When I'm working with Vite and there are CLI prints in the terminal that mention the path, it prints the entire PC path.

image

Reproduction

https://stackblitz.com/edit/vitejs-vite-vwvezs?file=index.html

Steps to reproduce

Open a project in windows and make the CLI print your path.

System Info

Windows 11

Used Package Manager

npm

Logs

No response

Validations

@stackblitz
Copy link

stackblitz bot commented Oct 25, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@bluwy
Copy link
Member

bluwy commented Oct 25, 2023

It's not a Windows only issue. The full path is intentionally printed by esbuild for the error message.

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2023
@muchisx
Copy link
Author

muchisx commented Oct 25, 2023

It's not a Windows only issue. The full path is intentionally printed by esbuild for the error message.

Got it, is there anyway to customize it through Vite to print only the project's path?

@bluwy
Copy link
Member

bluwy commented Oct 25, 2023

If you want to, you can use customLogger (https://vitejs.dev/config/shared-options.html#customlogger), following the example shown you can override .warn and .error to strip out any string paths that matches process.cwd() and the normalized version (slashes instead of backslashes). "vite" also exports normalizePath() which you can pass process.cwd() to get the normalized version.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants