in the new multiplatform gradle setup, how do we s...
# javascript
g
in the new multiplatform gradle setup, how do we specify js options?
o
Yeah, it’s kinda messy right now, but we are working on the proper DSL. For now try to use this (replace
js
with the name of your js target):
Copy code
configure([js]) {
            tasks.getByName(compilations.main.compileKotlinTaskName).kotlinOptions {
                sourceMap = true
            }
        }
👍 1
g
By js target do you mean:
fromPreset(presets.js, 'js')
Ok so this worked actually
Copy code
targets {
        fromPreset(presets.jvm, 'jvm')
        configure(fromPreset(presets.js, 'js')) {
            tasks.getByName(compilations.main.compileKotlinTaskName).kotlinOptions {
                sourceMap = true
            }
        }
    }
Thanks for your help
h
btw, is there a list of such options to be found somewhere?
1
g
Not officially, but if you go here https://github.com/Kotlin/kotlin-frontend-plugin and in the readme look at the first code section you'll see
compileKotlin2Js
. The
kotlinoptions
in there are the ones you can use. Just without the
kotlinoptions
prefix.
also, I haven't tried, but the kotlinfrontend plugin will probably still work
I decided to setup my own webpack config with npm though, which is what i would recommend until the new kotlinjs multiplatform dsl gets sorted out