https://kotlinlang.org logo
h

Hamza

10/26/2018, 10:09 AM
How can I compile Kotlin-JavaScript to JavaScript files in a multiplatform project? There is only one gradle file
g

gildor

10/26/2018, 10:11 AM
only one gradle file? what do you mean
h

Hamza

10/26/2018, 10:12 AM
like the new multiplatform version type
not the one with a build gradle file for each module
g

gildor

10/26/2018, 10:12 AM
so?
h

Hamza

10/26/2018, 10:13 AM
just giving more info…
g

gildor

10/26/2018, 10:14 AM
you define js in
targets
, as I understand
h

Hamza

10/26/2018, 10:16 AM
doesn’t help too much. doesn’t show how to compile the kotlin source into javascript source
g

gildor

10/26/2018, 10:17 AM
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

Hamza

10/26/2018, 10:18 AM
oh.. 🤦‍♂️ . thanks
one final question, how can i get gradle to generate the kotlin master stdlb file for me?
g

gildor

10/26/2018, 10:22 AM
master stdlb? for JS?
h

Hamza

10/26/2018, 10:22 AM
yep
g

gildor

10/26/2018, 10:22 AM
Not sure how this work with new MPP plugin, for js plugin it generates it automatically
h

Hamza

10/26/2018, 10:23 AM
yeah, it doesn’t do so with mpp
g

gildor

10/26/2018, 10:23 AM
I also had this problem with one of my pet js projects
don’t re member how I solved
h

Hamza

10/26/2018, 10:23 AM
is it on github?
g

gildor

10/26/2018, 10:25 AM
Maybe just dpend on stdllib from dependencies
Not sure, probably not
h

Hamza

10/26/2018, 10:32 AM
i meant is your project on github 😅
g

gildor

10/26/2018, 10:34 AM
yes, I understand
h

Hamza

10/26/2018, 10:34 AM
okay. i have the kotlin-js stdlib in my jsmain as implementation but that didn’t compile it
g

gildor

10/26/2018, 10:36 AM
No, I mean I used stdlib as npm dependency
h

Hamza

10/26/2018, 10:36 AM
oh, im using js as client with ktor as backend
isn’t npm only for back end (server)?
g

gildor

10/26/2018, 10:38 AM
no, if you use something like webpack to merge js files or any other way to work with dependencies for js
h

Hamza

10/26/2018, 10:38 AM
ok, ill check it out
g

gildor

10/26/2018, 10:39 AM
For real project I anyway would use DCE instead of full stdlib
actually maybe DCE generates stdlib 🤔
honestly don’t remember
h

Hamza

10/26/2018, 10:39 AM
well im a noob at js, and i dunno what webpack is, so im learning everything
g

gildor

10/26/2018, 10:39 AM
h

Hamza

10/26/2018, 10:39 AM
kk, thanks
g

gildor

10/26/2018, 10:40 AM
and with DCE you should get special stripped version of stdlib
h

Hamza

10/26/2018, 10:40 AM
and i should use dce with webpack, or is dce standalone?
g

gildor

10/26/2018, 10:40 AM
standalone
👍 1
h

Hamza

10/26/2018, 12:06 PM
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