trying to package a small compose/canvas app into ...
# compose-web
j
trying to package a small compose/canvas app into a node module. every example i’ve found so far uses the
browser()
target and produces a
binaries.executable()
. whereas I’m looking to use
nodejs()
and
binaries.library()
. part of the set up of the former is including a
<script src="skiko.js"></script>
in the index.html. from what i can tell, this script is responsible for producing an
onWasmReady()
function and probably goes about loading the skiko.wasm file. but if i’m packaging a node module, i don’t want the outside app (a react app in our case) to know anything about the internals of this node module, so I don’t want it to be responsible for loading
skiko.js
, instead i’d rather the node module i’m building in kotlin/js take care of that. does anyone know how i might accomplish this?
also of note, i noticed when targeting nodejs, a
skiko-kjs.js
is created in the build step. does anyone know what this is?
o
As far as i remember, skiko-kjs.js is just an intermediate output (in kotlin sync folder?) for skiko library. It doesn't need to be imported/loaded, so you can ignore it. The use case you describe was not considered out of a box before. Perhaps you may look into manually (adding a custom gradle task?) merging skiko.js with the output of your library.
j
ok interesting. from what i can tell the skiko-kjs,js does indeed get included in the nodejs package (i.e. if you
jsNodeProductionLibraryDistribution
it’s included in
build/productionLibrary
). maybe that’s an oversight then? I see what you’re saying about merging, that’s an interesting idea, will look into it. thank you