
To debug a Kotlin/JS application targeting Node.js:īuild the project by running the build Gradle task.įind the resulting. If your project targets Node.js, you can debug it in this runtime. Learn more about debugging in IntelliJ IDEA.īecause of the limitations of the current JavaScript debugger in IntelliJ IDEA, you may need to rerun the JavaScript debug to make the execution stop on breakpoints. You can now start debugging the program using the whole set of tools that the IDE offers: breakpoints, stepping, expression evaluation, and more. The output items reference the Kotlin source files and lines they come from:Ĭlick the file reference on the right to navigate to the corresponding line of code. You can see the console output of your program in the Debug window in IntelliJ IDEA. Start the debugging session by running the JavaScript debug configuration you've created previously: Learn more about setting up JavaScript debug configurations. Specify the configuration Name and provide the URL on which the project runs ( by default).
#Js script debugger code
IntelliJ IDEA Ultimate provides a powerful set of tools for debugging code during development.įor debugging Kotlin/JS in IntelliJ IDEA, you'll need a JavaScript Debug configuration. This also makes it possible to debug Kotlin's main() method which is executed when the script is loaded for the first time. As with regular JavaScript code, any set breakpoints will persist across page reloads. The developer tools even support setting breakpoints within a statement. Set a breakpoint by clicking on one of the line numbers. Navigating to the Kotlin file shows you the regular Kotlin code (as opposed to minified JavaScript): Alternatively, you can manually switch to the Sources tab and find the file you need in the file tree. Depending on your browser, these logs can reference the Kotlin source files and lines they come from:Ĭlick the file reference on the right to navigate to the corresponding line of code.

If your program is logging information to the console, navigate to the Console tab to see this output.
#Js script debugger how to
Learn how to find the developer tools in popular browsers. Navigate to the page in the browser and launch its developer tools (for example, by right-clicking and selecting the Inspect action). Run the project by calling one of the available run Gradle tasks, for example, browserDevelopmentRun or jsBrowserDevelopmentRun in a multiplatform project. Refer to your browser's documentation for more details. Most modern browsers provide tools that allow inspecting the page content and debugging the code that executes on it. The Kotlin/JS Gradle plugin automatically generates source maps for the project builds, making them available without any additional configuration. This way, the source maps enable support for debugging the code during its execution. JavaScript source maps provide mappings between the minified code produced by bundlers or minifiers and the actual source code a developer works with.
