https://kotlinlang.org logo
#javascript
Title
# javascript
c

Császár Ákos

03/21/2024, 11:28 AM
Hi! I am trying to create 2 source sets, one for
web
and one for
react native
. It would be great, to have the possibility to run separate
jsBrowserProductionWebpack
on them, so I can publish them separately to npm. My first idea was to create separate compilations in the
js(IR)
block, and register a task for both (something like
tasks.register<KotlinWebpack>("name")
), but I'm not sure if its the right way to do it and I also encountered some errors. Is there any better way to do it?
a

andylamax

03/22/2024, 8:23 AM
Instead of 2 sourceSets, I suggest you use 2 submodules. One for
web
and another one for
react-native
c

Császár Ákos

03/22/2024, 9:15 AM
And is it possible to achieve something similar with multiple compilations? If yes, what do I need exactly? Do I need configure webpack, or do I need to create custom tasks? I am asking because, currently I have a core lib which is consumed by another lib, so if I add another module in core, then i also should add a module to the consumer and it feels a little bit overkill, Maybe I am wrong.
a

andylamax

03/22/2024, 11:21 AM
I recall trying to solve something similar with multiple compilations and failing. I have resorted to multiple modules ever since. Is it a bit over kill? I really don't think so. But again the term "overkill" can be subjective
👍 1
c

Császár Ákos

03/22/2024, 11:31 AM
I just think it would look better by solving it with extra compilations/source sets if we already have source sets in KMP., but I think I will give a chance to the multi module setup because it seems easier.