How can I compile Kotlin-JavaScript to JavaScript ...
# multiplatform
h
How can I compile Kotlin-JavaScript to JavaScript files in a multiplatform project? There is only one gradle file
g
only one gradle file? what do you mean
h
like the new multiplatform version type
not the one with a build gradle file for each module
g
so?
h
just giving more info…
g
you define js in
targets
, as I understand
h
doesn’t help too much. doesn’t show how to compile the kotlin source into javascript source
g
What is exactly problem? If you run task
build
, it will build code for all platforms and you will have .js file in output
h
oh.. 🤦‍♂️ . thanks
one final question, how can i get gradle to generate the kotlin master stdlb file for me?
g
master stdlb? for JS?
h
yep
g
Not sure how this work with new MPP plugin, for js plugin it generates it automatically
h
yeah, it doesn’t do so with mpp
g
I also had this problem with one of my pet js projects
don’t re member how I solved
h
is it on github?
g
Maybe just dpend on stdllib from dependencies
Not sure, probably not
h
i meant is your project on github 😅
g
yes, I understand
h
okay. i have the kotlin-js stdlib in my jsmain as implementation but that didn’t compile it
g
No, I mean I used stdlib as npm dependency
h
oh, im using js as client with ktor as backend
isn’t npm only for back end (server)?
g
no, if you use something like webpack to merge js files or any other way to work with dependencies for js
h
ok, ill check it out
g
For real project I anyway would use DCE instead of full stdlib
actually maybe DCE generates stdlib 🤔
honestly don’t remember
h
well im a noob at js, and i dunno what webpack is, so im learning everything
g
h
kk, thanks
g
and with DCE you should get special stripped version of stdlib
h
and i should use dce with webpack, or is dce standalone?
g
standalone
👍 1
h
looking into dce, isn’t it a plugin? How will i integrate it with the MPP application? my apologies, i am not very good at gradle :{
Thanks. I will give this a shot