I have kind of implemented a ServiceLoader mechani...
# javascript
r
I have kind of implemented a ServiceLoader mechanism in JS and now I don't find the service (the registration of the service happens within B)
a
I had the same problem and studied different solutions. It is not possible to implement full analog of service loader in JS due to webpack and DCE. So the best way is to add explicit requirements for your modules at the start of actual application. You can even do it in a type safe way
r
I agree that is it not possible in the same way but... I define the dependencies already in gradle, I hoped I don't have to do the same thing in JS (or in other words, Kotlin does it for me)
a
The problem is that gradle and webpack do not actually talk well yet. Also you do not really want to actually forgo DCE for web-based projects.
r
In my case DCE is not of such an importance but I see what you mean
a
You can see JS program as a fat-jar in terms of
shadow
plugin. In order to make it work with service loader, you need build system support.
I think that I've opened an issue about it or intendend to do so...
Maybe you need to create a separate issue instead of the comment
The implementation could be like this:
frontend
plugin searched all projects for specific export flag and automatically adds requires.
r
yeah... I was thinking about creating a gradle plugin for it but in the end the hassle is probably not worth it. I'll do the require manually
thanks for your thoughts