kobweb icon indicating copy to clipboard operation
kobweb copied to clipboard

Support granular per-module compilation mode

Open bitspittle opened this issue 3 years ago • 0 comments

Starting in 1.6.20, the Kotlin/JS compiler defaults to creating one JS file per module, instead of one uber JS file for the whole program. See also: https://kotlinlang.org/docs/whatsnew1620.html#separate-js-files-for-project-modules-by-default-with-ir-compiler

We might want to support this in Kobweb (in theory, lots of smaller pieces may mean that browser caches don't have to download as much when visiting new revisions of Koweb sites), but to do so, we'd need to know the import order of the JS files.

In other words, right now where we have:

# index.html (current)

<script src="mysite.js"></script>

we'll need to do something like:

# index.html (future)

<script src="a-library.js"></script>
<script src="yet-another-library.js"></script>
<script src="a-third-library.js"></script>
<script src="mysite.js"><script>

where the order matters when intermediate JS files depend on previous ones.

Currently, I can see all the JS files dumped into a build directory. I just don't know how to sort them before including them into my index.html file.

bitspittle avatar Oct 13 '22 23:10 bitspittle