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

Ilia Tochilin

03/29/2023, 2:05 PM
Is there a way to use two kotlin/js projects with browser target so the first has the second as a dependency, but I would want to have them connected maybe like modules in IntelliJ project structure to work with it like with one project, so if I change something in the second and do module build in first it would work automatically ?
d

Derek Ellis

03/29/2023, 2:07 PM
You can have multiple gradle subprojects, each set up as kotlin/js browser projects, and then one project can depend on the other project
i

Ilia Tochilin

03/29/2023, 2:11 PM
Are you talking about submodules in gradle ?
d

Derek Ellis

03/29/2023, 2:12 PM
Yes
i

Ilia Tochilin

03/29/2023, 2:13 PM
I don’t want them to be gradle submodules. I have a library and let’s say 10 different projects which use it, I would need to be able to open any of these projects with this library in one idea and work with it as if they would be submoduls
l

Landry Norris

03/29/2023, 2:20 PM
If you want them to live in different projects, you can publish to maven local. Then add it as a dependency in the other projects, making sure to add mavenLocal as a repository.
i

Ilia Tochilin

03/29/2023, 2:22 PM
Actually it’s the only idea I have, but when I used maven it worked without publishing to mavenlocal, IntelliJ just knew that my dependency is opened in the same window and compiled that code
a

Adam S

03/29/2023, 2:27 PM
it sounds like you want composite builds? So you can have a Gradle project and use another (independent) Gradle project as a dependency. IntelliJ understands composite builds, so it will show both projects in one IntelliJ instance
1
t

turansky

03/29/2023, 2:37 PM
Is it for workers?
i

Ilia Tochilin

03/29/2023, 2:39 PM
Workers ?
Service workers ?
t

turansky

03/29/2023, 2:41 PM
I use custom Gradle configuration to link subprojects
I use it for Web Workers
KFC
application
plugin search project dependencies with
jsMainModule
configuration and link compile tasks. Code
Do you need something similar?
i

Ilia Tochilin

03/29/2023, 3:04 PM
Probably, but would be ideal without need of writing own plugin
t

turansky

03/29/2023, 3:06 PM
Do you use second subproject as additional Webpack entry point?
i

Ilia Tochilin

03/29/2023, 3:07 PM
No ?
Composite build does the trick, thanks !
6 Views