# Debug

# Chrome Inspector

When working on GraalVM (opens new window) or a JDK with the graalvm (JVMCI) bits, start your application as:

npm start -- -Dinspect

This will start a Chrome inspector debugger agent on port 9229 that you can attach for a remote debug session from your Browser.

Chrome devtools listening at port: 9229
Running: java ... 
Debugger listening on port 9229.
To start debugging, open the following URL in Chrome:
Server listening at: http://localhost:8080/


You will be able to set breakpoints, debug etc...

# Debug from VSCode

The usage of Chrome devtools is not a hard requirement. You can also debug the application using Visual Studio Code (opens new window). Create a runner configuration as:

es4x vscode

This will create a launcher.json similar to this:

  "version" : "0.2.0",
  "configurations" : [ {
    "name" : "Launch empty-project",
    "type" : "node",
    "request" : "launch",
    "cwd" : "${workspaceFolder}",
    "runtimeExecutable" : "${workspaceFolder}/node_modules/.bin/es4x-launcher",
    "runtimeArgs" : [ "-Dinspect=5858" ],
    "port" : 5858,
    "outputCapture" : "std",
    "serverReadyAction" : {
      "pattern" : "started on port ([0-9]+)",
      "uriFormat" : "http://localhost:%s",
      "action" : "openExternally"
  } ]

And attach your debugger.


If you print the message Server started on port 8000 it will be captured by visual studio and a browser window will open the url in question.