Getting source maps to work


#1

Hi,

I’m compiling Kotlin to JS using version 1.2.21 and my project is organised using Maven.

I’ve enabled to source maps generation in the maven plugin compiler and I’m using maven to compile my kotlin to js.

I’ve turned on source maps in the browser.

I’ve created an HTML file at root level in my maven module which points to the compiled js files residing in target/js

However when I try to open my kotlin file main.kt in the browser then it’s blank. See attached pictures.


As you can see the browser detects the Kotlin source maps but not my application’s source map.

I’m opening the HTML file from IntelliJ, which opens the file in my browser on a URL like this:
http://localhost:63342/kotlinweb/pure-kotlin/index.html?_ijt=d3mbfpeq41htniccugtrkkb3a8

Has anyone this experience? And know if it’s a bug somewhere?


#2

@jvskriubakken please create an issue with a sample project if possible.


#3

Looks like you/we have an issue with paths, you can try to workaround it by inlining all sources to .map file with setting sourceMapEmbedSources to “always” (see https://kotlinlang.org/docs/reference/using-maven.html#attributes-specific-for-js)