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.:
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 🐞
- 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.
- Run
DEBUG=vite:hmr bin/vite dev --debug and observe that this doesn't limit debugging to vite:hmr only, instead it logs everything.
- Run
DEBUG=vite:hmr bin/vite dev and observe that this works as expected
bundle update vite_ruby.Description 📖
Looking at the documentation on debugging Vite:
The
--debugflag 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.: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
DEBUGenv var, e.g. we can try:However, this also doesn't work as Vite seems to merge what is passed via the
--debugflag with what's inDEBUG, and if you use both, it appears to ignore the env var value.In the end you have to use only the env var:
And this behaves as expected. So basically you should not use the
--debugflag, and instead only use theDEBUGenv var if you want to limit the output that gets logged.Not sure if this is a "bug" with the
--debugflag 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--debugandDEBUG, and that passing features via--debugdoesn't work.Reproduction 🐞
bin/vite dev --debug hmrand observe that this doesn't work as expected – the HMR argument is instead used as base directory I believe.DEBUG=vite:hmr bin/vite dev --debugand observe that this doesn't limit debugging to vite:hmr only, instead it logs everything.DEBUG=vite:hmr bin/vite devand observe that this works as expected