Seems like an IDE issue. Breakpoints are not attac...
# javascript
e
Seems like an IDE issue. Breakpoints are not attached, but a
debugger;
statement works.
t
thank you color 1
b
Or it can be incorrectly generated source maps. Could you open the generated source map in IDEA's source map visualizer and see which line in the generated JS code corresponds to the source line where you're trying to set the breakpoint?
e
> Or it can be incorrectly generated source maps If that was the case, should I be able to step through the code? Because if I place the debugger statement at the top, I can step through (and in) the code correctly.
🤔 1
b
Then probably source maps are not the issue, although I'm not 100% sure.
e
I need to find the time to downgrade the IDE to 2024.3
But it's strange. On the same IDE, a 1.9.24 project debugs correctly.
generated source map in IDEA's source map visualizer
Is this a plugin? I've never seen or used it
b
Oh, sorry, it's probably only available in the Ultimate edition as part of the JavaScript plugin. You can send me the source map and the file and I can check it for you if it's okay.
e
I'm on Ultimate! Maybe I have no idea how to open it. Is it done just by opening the .map file? I can see the raw representation only
b
There should be a tab called "Visualizer" on the left corner below the text editor.
Screenshot 2025-05-07 at 16.44.31.png
e
Found, thanks! Had no idea that existed lol. Let me see if I can check what you asked me
Found the real culprit: it's the
whole-program
granularity that makes it impossible to debug. When I switch back to
per-module
, breakpoints are correctly attached.
This is what I can see
b
So, seems like the relative paths inside the source map weren’t resolved correctly. Could you create an issue please?
e
Will do. Let me try to embed the Kotlin sources in the map file.
b
Or you can just replace relative paths with absolute ones
t
AFAIK It already exists
cc @Michael Porotkin
e
@broadway_lamb should this be sufficient to embed the .kt sources in the .map file?
Copy code
binaries.withType<JsIrBinary>().configureEach {
  linkTask.configure {
    compilerOptions {
      sourceMap.set(true)
      sourceMapEmbedSources.set(JsSourceMapEmbedMode.SOURCE_MAP_SOURCE_CONTENT_ALWAYS)
    }
  }
}
Asking as I can't get the
sourcesContent
to be populated.
b
It should be sufficient, yes.
e
Then something is going wrong. I'll open an issue in YT about
whole-program
source maps. And I'll also mention the fact
sourcesContent
is never populated.
thank you color 2
There was an idea about deprecating
per-module
, please don't do that 😂
b
Thanks!