Hi! I have a kotlin/js project, where I want to se...
# javascript
c
Hi! I have a kotlin/js project, where I want to set up a very basic UI for my kotlin code. I added an
index.html
file to the resources directory and then I tried to run the
jsBrowserRun
task. How can I add my kotlin code as a script to the html file? I assume I need to generate a .js file or it is done automatically when I run jsBrowserRun. Can someone explain to me how it works?
a
You need to add into your
index.html
the script tag manually with the name of your module like here: https://github.com/kotlin-hands-on/jvm-js-fullstack/blob/final/src/commonMain/resources/static/index.html#L9 So, if your module name is
awesome-kotlin-js-project
you need to add:
Copy code
<script src="awesome-kotlin-js-project.js"></script>
c
Awesome! Thank you!