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

Feature flag for --debug not working, maybe need to update docs #501

Open
2 tasks done
adamreisnz opened this issue Oct 7, 2024 · 2 comments
Open
2 tasks done

Feature flag for --debug not working, maybe need to update docs #501

adamreisnz opened this issue Oct 7, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@adamreisnz
Copy link

  • I have tried upgrading by running bundle update vite_ruby.
  • I have read the troubleshooting section before opening an issue.

Description 📖

Looking at the documentation on debugging Vite:

The --debug flag is mentioned, and as per the Vite documentation it should be able to accept a feature identifier string, for example --debug hmr, to only debug output for that specific component, e.g.:

bin/vite dev --debug hmr

However, this doesn't work, as it interprets the parameter as something else and breaks the dev server altogether. Probably because the parameter isn't being passed by Vite Ruby to Vite itself?

So if we follow the Vite Ruby documentation, there is a second way to limit what gets logged, by using DEBUG env var, e.g. we can try:

DEBUG=vite:hmr bin/vite dev --debug

However, this also doesn't work as Vite seems to merge what is passed via the --debug flag with what's in DEBUG, and if you use both, it appears to ignore the env var value.

In the end you have to use only the env var:

DEBUG=vite:hmr bin/vite dev

And this behaves as expected. So basically you should not use the --debug flag, and instead only use the DEBUG env var if you want to limit the output that gets logged.

Not sure if this is a "bug" with the --debug flag perse (as it doesn't seem to pass the feature), or if documentation needs to be updated to clarify that you shouldn't use both --debug and DEBUG, and that passing features via --debug doesn't work.

Reproduction 🐞

  1. Run bin/vite dev --debug hmr and observe that this doesn't work as expected – the HMR argument is instead used as base directory I believe.
  2. Run DEBUG=vite:hmr bin/vite dev --debug and observe that this doesn't limit debugging to vite:hmr only, instead it logs everything.
  3. Run DEBUG=vite:hmr bin/vite dev and observe that this works as expected
@adamreisnz adamreisnz added the bug: pending triage Something doesn't seem to be working, but hasn't been verified label Oct 7, 2024
@ElMassimo ElMassimo added documentation Improvements or additions to documentation enhancement New feature or request and removed bug: pending triage Something doesn't seem to be working, but hasn't been verified documentation Improvements or additions to documentation labels Oct 7, 2024
@ElMassimo
Copy link
Owner

The --debug flag is mentioned, and as per the Vite documentation it should be able to accept a feature identifier string

That portion of the Vite guide, and the feature itself are significantly more recent than the Vite Ruby CLI.

Allowing debug to take a value makes sense, though dry-cli doesn't seem to currently support options that can be both boolean or string:


In the meantime, follow the Debugging section in Vite Ruby:

@adamreisnz
Copy link
Author

adamreisnz commented Oct 7, 2024

Thanks I expected as much. Yes I did follow the guide, but I think it'd be worth updating the guide and at least mention that you cannot use --debug and DEBUG=xxxxx at the same time. It took a bit of trial and error to figure that out, and currently the guide implies that you can/should use both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants