Could someone explain me why i need to use `binari...
# javascript
j
Could someone explain me why i need to use
binaries.executable()
in js block
Copy code
js(IR) {
        browser()
        nodejs()
        binaries.executable()
    }
Is it necessary to add in multiplatform library?
🚫 1
j
You also don't need: • `IR`: It's the only backend for JS now. • Both
nodejs()
and
browser()
unless you explicitly have behavior that varies across those runtimes.
👍 1
c
Are you sure about that second point? I get (Kotlin 2.0.0):
Copy code
w: Please choose a JavaScript environment to build distributions and run tests.
Not choosing any of them will be an error in the future releases.
kotlin {
    js {
        // To build distributions for and run tests on browser or Node.js use one or both of:
        browser()
        nodejs()
    }
}
j
I am also getting this
after adding my question
Copy code
w: Please choose a JavaScript environment to build distributions and run tests.
Not choosing any of them will be an error in the future releases.
kotlin {
    js {
        // To build distributions for and run tests on browser or Node.js use one or both of:
        browser()
        nodejs()
        d8
    }
}
e
One target must be activated. It's also used to run tests. Normally I want to run tests both in the browser and on Node, so I activate both of them.
binaries.executable()
or
binaries.library()
are useful if you want to output an executable application, or if you want to output a JS library (e.g. a Node package).
1
If your KMP library is pure Kotlin, and is expected to be consumed from Kotlin only, you don't need to specify the binary type.
🙌 1
j
@CLOVIS I said you don't need both. Not that you don't need any.
👍 1