-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
chore: centralize debug codes #4446
Conversation
7f1a393
to
6d322f5
Compare
To be honest, I don't see much value of introducing this change, but might introduce additional fiction to developers to debug and making changes. |
What do you mean by Beside that I think it would be nice if we document the different CLI debug filters (we can talk about this here https://discord.com/channels/804011606160703521/870545448618819626/870545450376261662, and/or in another PR) |
Let's imagine the scenario when will someone want do use the debugger of Vite - they are mostly trying to find the internal bug of vite, or trying to understand how vite work. Either way, they should already reading the source code of vite. Before this change, each usage of debug is definite inside their corresponding module, when you trying to debug the module you can easily pick up the debug code and try it in the console (which is pretty good self-documenting to me). Now with centralized codes, you will need to jump to the file to see it (not so hard on VS Code, but how about GitHub or some other editors?) The
I would feel this is a bit over-engineering tbh. |
That are some good points from @antfu ... But I'm not going with all of your points.
This is not even bad but just clean up the always getting bigger and bigger project.
I never had problems with importing stuff from different files. VSCode always helped me and even organized them. So I never really care about imports.
That is a valid and true point.
Yeah, that's the whole point of bringing everything together in one place instead of leaving everything lying around in different places. With that you can now jump through the (code in your IDE, or in GitHub source code view, sadly not the review panels) and explore all places that contains debugging stuff.
Sure, that's not necessary if wanted. But not part of this PR.
I think it's worth to be clearly documented, cause not everyone (even me before this PR!) knows that you can debug with that way. The user documentation doesn't say anything about this debug possibility.
I don't think so, I wasn't aware myself that you can e.g. debug like that + it's even possible to use patterns like And yeah you can also filter by To sum up what I want to achieve is improved user documentation for DEBUG mode. |
Given that we don't get type safety as people can still just pass in a string, the extra import looks like too much for what we get. I don't see much of a difference in DX by centralizing things in the code instead of in the documentation. I totally agree with you about a big hole in the docs here. @ElMassimo wrote a post about this https://maximomussini.com/posts/debugging-javascript-libraries/ that fills in some of these gaps and the idea was to maybe add something similar in an advanced section in the docs.
|
Description
Centralize debug codes in one place and add code comment documenting their usage
Additional context
I had a hard time figuring out how to turn on debug logs. By putting them all in one place and adding a code comment explaining how to use them it should make it easier to get started using them
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).