Closed ismai117 closed 1 year ago
I tried this solution but its not working val jsMain by getting { dependsOn(commonMain) dependencies { implementation(compose.html.core) implementation("io.realm.kotlin:library-base:$realmVersion") { exclude(group = "io.realm.kotlin", module = "library-base") } implementation("io.realm.kotlin:library-sync:$realmVersion") { exclude(group = "io.realm.kotlin", module = "library-sync") } } }
It seems that Realm.db doesn't support JS target.
thanks @pablichjenkov , it looks this js(IR) { browser() } is causing the issue. can I exclude realm inside js(IR) { exclude ("io.realm.kotlin:library-base:1.11.0") } ?
js(IR) { browser() configurations { all { exclude(group = "io.realm.kotlin", module = "library-base") exclude(group = "io.realm.kotlin", module = "library-sync") } } }. I did this, it removed the error but now its removed realm for iOS, android and desktop
I don't think an exclusion rule will apply here. It would be a nice feature request but normally gradle tries to resolve all dependencies first then apply the exclusion rules. In any case the exclusion rule should be applied in the JS target only, your code above is basically removing it from everywhere.
You should create an intermediate target named onlyMobile, it will have your only mobile dependencies, then make Android and iOS target depend on onlyMobile. Your realmdb dependency will be in onlyMobile not in common. I could provide some code snippet but I am on my phone atm.
yeah that would be a great feature, also I'm using realm for desktop so can you show a snippet when you're free please. thanks!
Thank you @pablichjenkov for helping with this question! :)
@ismai117 Feel free to add more questions if needed.
To summarize: If some libs don't support a particular target (k/js in this case), then that target shouldn't have it as a dependency. As @pablichjenkov has shown, it can be done by adding extra source sets to for supported/unsupported targets.
that's all sorted on my side now, thanks for the help!!
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
I'm using realm in my kmp app, I know that realm isn't compatible with web yet so I want to run web without realm library but I keep on receiving an error