Hi all, moko resources is great, working fine on a...
# moko
s
Hi all, moko resources is great, working fine on android, ios and desktop, BUt on web i am not able to make it work, getting following error:
Module not found: Error: Can't resolve 'localization/comyourflixercommon_stringsJson.json' in '/Users/sunil/AndroidStudioProjects/YourFlixer-KMP/build/js/packages/yourflixer/kotlin'
Any idea?
I have followed this related link. https://github.com/icerockdev/moko-resources/issues/392 But still not able to make it work.
m
In my case I found that I needed to explicitly state that jsMain depends on commonMain in build.gradle to get it to work: e.g.
Copy code
sourceSets {
   commonMain {
    
   }

   jsMain {
       dependsOn commonMain
   }
}
Even though jsMain dependsOn commonMain itself, adding it explicitly made it cooperate for me.
s
Thats already added there actually.
m
Not sure if you mean that you already had that line explicitly in your Gradle file, or if you mean that jsMain always depends on commonMain without needing to add it explicity
I know that after I added that explicitly moko resources is working in my multimodule project
s
I mean, i already added that line explicitly, But still not working
m
Then unfortunately I haven't seen anything else. In case it helps, this is my project that is using it if you want to compare gradle files (our resources / the moko plugin is in the core project, which is used by app-react and others): https://github.com/UstadMobile/UstadMobile/tree/dev-mvvm-primary
s
ok, thnx, actually i have added moko plugin also in both modules, still having issues.
@alex009, any idea about this issue, i tried every possible point mentioned in that request.., But still no luck on web
a
hi. can you compare your project with samples from moko-resources repository? also you can compile sample and compare
build
directory content with
build
content of your projects. maybe you find step where resources not pass on next step. for example resources was successful generated inside
build/generated
, next successful packed into
klib
, but from
klib
to app not copied
s
ok
One question @alex009, is
moko-resources-generated.js
webpack file generated only once after setting up moko resources?, Actually in moko resources sample, after first successful run, if i delete
webpack.config.d/moko-resources-generated.js
file from webApp just for testing, then it does not work, start getting the same error i am gettting. AND after that i tried every possible thing, clean build, invalidate cache and all, but id did not generated that file again, whats the reason? AND that same reason is for my issue. It didnt generated that file in webApp but only generated in shared module, Not sure what is the reason, But if i manually copy that file into webApp as well, then it works. SO the main question here: is that moko webpack config file is generated only once only after the setup as i am not able to generate it again.. EVen i tried generateMRCommonMain as well
It only regenerates that file again if we update any of resources files in MR
BUt it have one issue, IF we already have some
webpack.config.d/somefile
file in webApp, then it does not generate
moko-resources-generated.js
in webApp, this was the main reason in my case.
IN moko resources sample, its regenerating even in that case also(when already have some webpack file in webAPp), but in my project its not regenerating in that case..
a
hi.
moko-resources-generated.js
is generated at
generateMRjsMain
task run. this file required for plugin. also you should add moko-resources plugin in shared module and web app module. both module should have applied plugin. in webapp plugin will copy resources from dependencies and pack into app.
s
Its already applied at both sides. But still this issue
148 Views