Debug Breakpoint support (--inspect-brk flag)

I’m trying to debug the server side rendering in a JetBrains IDE, part of that is starting the Node server with the --inspect or --inspect-brk flags. Is there builtin support in Frontity to do this? I couldn’t find anything in the docs.

HI @scarabcoder,

You can start the dev server like:

node --inspect -r ts-node/register/transpile-only ./node_modules/.bin/frontity dev

We use this in the frontity.org theme as well as in the examples in the main frontity repo.

That said, we haven’t tested it in any JetBrains IDEs but I assume that you can just set a breakpoint normally once you run your project like this.

What we’ve succesfully tested is the debugging of a Frontity App with Visual Code by using the related extension

Hm, how would I run that from a project installation? ‘npx frontity dev:inspect’ doesn’t seem to work. I tried running what you pasted in there (with the ", at the end removed of course) and that throws an error:

basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at Module._compile (internal/modules/cjs/loader.js:895:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11

Hi @scarabcoder,

npx frontity dev:inspect will only work if you have that script defined such as in…

Yes, there are several ways to debug a React Isomorphic App. Here you have a videos where we go though some of these methods

Hope this helps