I am trying to run a kmm project js files on a browser. Here the html:
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="../packages_imported/kotlin/1.5.10/kotlin.js"></script>
<script src="../packages_imported/KotlinBigInteger-bignum-js-legacy/0.3.2/KotlinBigInteger-bignum-js-legacy.js"></script>
<script src="../packages_imported/kotlinx-coroutines-core/1.5.0-native-mt/kotlinx-coroutines-core.js"></script>
<script src="../packages_imported/ktor-ktor-io-js-legacy/1.6.0/ktor-ktor-io-js-legacy.js"></script>
<script src="../packages_imported/kotlinx-serialization-kotlinx-serialization-core-js-legacy/1.2.1/kotlinx-serialization-kotlinx-serialization-core-js-legacy.js"></script>
<script src="../packages_imported/kotlinx-serialization-kotlinx-serialization-json-js-legacy/1.2.1/kotlinx-serialization-kotlinx-serialization-json-js-legacy.js"></script>
<script src="../packages_imported/ktor-ktor-utils-js-legacy/1.6.0/ktor-ktor-utils-js-legacy.js"></script>
<script src="../packages_imported/ktor-ktor-http-js-legacy/1.6.0/ktor-ktor-http-js-legacy.js"></script>
<script src="../packages_imported/ktor-ktor-http-cio-js-legacy/1.6.0/ktor-ktor-http-cio-js-legacy.js"></script>
<script src="../packages_imported/ktor-ktor-client-core-js-legacy/1.6.0/ktor-ktor-client-core-js-legacy.js"></script>
<script src="./parippu-vada/kotlin/parippu-vada.js"></script>
<title>Title</title>
</head>
<body>
</body>
</html>
This throws the following error:
_Collections.kt:1618 Uncaught TypeError: Cannot read properties of undefined (reading 'iterator')
at _Collections.kt:1618
at parippu-vada.js:23
at parippu-vada.js:25
Its shows error in collections.kt @:
/**
* Applies the given [transform] function to each element of the original collection
* and appends the results to the given [destination].
*/
public inline fun <T, R, C : MutableCollection<in R>> Iterable<T>.mapTo(destination: C, transform: (T) -> R): C {
for (item in this) <- this throw error
destination.add(transform(item))
return destination
}
Its probably related to kotlin version because the error is in auto-generated file. Is there anything I can do about this.
Am almost giving up on kmm, some inspiration would be nice !