Is it possible to call Kotlin from JavaScript (`LE...
# javascript
t
Is it possible to call Kotlin from JavaScript (
LEGACY
) via generated static web page (using
./gradlew browserDistribution
and opening generated
index.html
in browser)? (looking to create a simple web page and deploy it to GitHub Pages) Kotlin (module named
webapp
)
Copy code
@JsExport
fun main() { <http://console.info|console.info>("hi") }

@JsExport
fun hello() { <http://console.info|console.info>("hi") }
JavaScript
Copy code
webapp.main() // Works when using `browserDistribution` and `browserDevelopmentRun` Gradle tasks.
webapp.hello() // Only works when using `browserDevelopmentRun` task.
Related Stack Overflow post: https://stackoverflow.com/q/65357186/196486
Through further experimentation, found that
browserDevelopmentWebpack
task works when using
LEGACY
compiler. Despite producing a bloated JavaScript output, it will suffice my needs until I can make the switch to the
IR
compiler.