This might just be me not knowing much about Webpa...
# javascript
c
This might just be me not knowing much about Webpack, but how can I call my Kotlin/JS browser code from a Webpack bundle generated with the 1.3.40 multiplatform lib? I’ve got my multiplatform lib set up, run
jsBrowserWebpack
to create the bundle, and added it to my HTML page with a
<script>
tag, but i can’t figure out how to access my module from there
I think I’ve got it figured out. The script tag needs the
type="module"
attribute, and the module runs within the Kotlin
main()
.
u
Casey, if there's any snippet of code I can look at I'd be very much obliged - out of the box kotlin code is not supposed to compile with es6 imports (one that are use with script type="module") so I'm not sure what this all about - but it would be very beneficial to learn.
c
Actually, I found that the
type="module"
wasn’t what was needed. Having the script compiled with a
main()
method is all that was needed. to get it to run. But it would be nice to use the module as a library (called from plain JS on the same page) instead of using it as a full app.
u
Thank you for the update) and for the request as well )