qwikifiers / qwik-nx

Nx plugin for Qwik
131 stars 24 forks source link

Add Debugging Mode Support #39

Closed n8sabes closed 1 year ago

n8sabes commented 1 year ago

Currently, there is no way to start a Qwik debugging session. If possible, please include serve.debug.

While I understand that serve may be commonplace in Nx, it would be super-uber-excellently nice to support dev and dev.debug to maintain consistency with the rest of Qwik documentation.

dmitry-stepanenko commented 1 year ago

We won't provide standalone target for this out of the box, but it can be easily achieved by adding the following target

"debug": {
  "executor": "nx:run-commands",
  "options": {
    "command": "node --inspect-brk ./../../node_modules/vite/bin/vite.js --mode ssr --force",
    "cwd": "apps/myapp"
  }
},
shairez commented 1 year ago

btw @dmitry-stepanenko - what are the reasons to not adding support for this out of the box?

dmitry-stepanenko commented 1 year ago

@shairez wanted to bring this to actually: I'm wondering if this would be needed for most of the developers out there, none of internal nx packages scaffold this out of the box (there's internal support in @nrwl/node, if I'm not mistaken, but don't think it counts). And I don't want to get too many configurations in project.json

We can either include this in the docs or add a separate generator that can scaffold this target on demand. Or do you think it would be better to just include it?

shairez commented 1 year ago

the issue is that with Qwik, the need to debug the server becomes a first class citizen, so it might come in handy more times than not

Is there anything technical preventing us from adding it? or is it just to try and keep things to the minimum?

dmitry-stepanenko commented 1 year ago

There're no issues with the target configuration that I've posted above. If you think it is worth having it, I'll create a PR

shairez commented 1 year ago

I think so

we can always remove it later if it becomes useless

thanks @dmitry-stepanenko ! 🙏

n8sabes commented 1 year ago

@shairez, I have debug working, thanks to @dmitry-stepanenko's help.

The challenge we face at this early stage of Qwik's lifecycle is making it brain-dead simple to adopt. People have become incredibly lazy and if it's not in-their-face-easy with zero-effort, they often move on to the next easiest thing. Qwik represents a serious advancement in enabling technology for the web and deserves lowering every barrier we can to fuel its success. Just my opinion, from marketing to DX.

Should the commands mimic those in Qwik (e.g. preview, dev, dev.debug), Nx common syntax, or both? I find it frustrating moving between my projects (dev vs. serve), often typing the wrong thing and grumbling each time.