How do you debug when using the task run
? Also how to debug if using webpack to create a single runnable file like here?
You need to start node in so-called “inspect” mode. After that you can attach your debuggers. For example IntelliJ has a run config for attaching debugger to node. Another debugger that can attach to node is chrome browser’s debugger. Having said this, I had only semi success when I tried this.
I managed to make it work by creating a run configuration for NodeJS in IntelliJ IDEA, running the built module of the project and making build/js
the working directory for the configuration:
The breakpoints are not always hit, especially when inside a library, but it’s a start I guess! Also I’d recommend to run the task compileKotlinJs
before launch (I have put another custom task in the picture but it depends on compileKotlinJs
).