Hi all,
I would like to write some org.w3c.dom.Node-related code in the commonMain source set of a jvm + js Multiplatform project but the compiler is not happy:
import org.w3c.dom.Node // compiler error here: Unresolved reference: Node
fun sayHello(node: Node) {
node.ownerDocument!!.createElement("div").textContent = "hello"
}
Is there any way to do so? My goal is to use this common code to process XML in the jvm part, and to process the browser DOM in the js part.
Please note that the same code is compiling properly in the jvmMain and jsMain source sets.
Below is a bit of information about my setup.
I have created a Kotlin Multiplatform Library project using IntelliJ IDEA 2021.1.
Then I removed the native source set to keep only common , jvm and js (browser target).
I changed the kotlin version to 1.5.20 in build.gradle.kts (just in case it may help, it was 1.4.32 before).