I followed the kotlinjs intro tutorial (<https://p...
# javascript
b
I followed the kotlinjs intro tutorial (https://play.kotlinlang.org/hands-on/Building%20Web%20Applications%20with%20React%20and%20Kotlin%20JS/01_Introduction) but I'm finding that whenever I update my build.gradle.kts file, intellij loses the source dirs. I searched around for this and found references to
sourceSets
, but it doesn't seem to work in a kotlinjs project. Is there something special I need to do there?
v
If you followed that tutorial you shouldn't need custom source sets. You can also compare what you have with the final result of the tutorial on GitHub. If you want help here you probably have to share your state.
b
I did follow the tutorial and checked the final result: it doesn't set any explicit source sets either. But every time I reload the gradle build file it loses my source directory and I have to re-mark it
v
You should not even need to initially mark them. Of course they get unmarked on sync again, because it is a sync. As I said, if you want help, you need to show what you have. Maybe you didn't follow the tutorial but put the files into some non-standard directory or similar. Also that tutorial surely does not instruct to mark any source directories manually, does it?
b
True, the tutorial did not explicity say that, but it's not been my experience that tutorials like that are always 100% perfect 🙂
I haven't touched anything in the
kotlin
block, that was created that way when I made the new kotlinjs project
v
That's just your build script
What files do you have and where exactly
b
source files are in
src/main/kotlin
index.html
is in
resources
v
Can't you simply provide the whole project? If there is something confidential, replace it by something dummy.
b
That would take some more time/thought, I think. But the file locations aren't different than the tutorial's repo. I suppose I should try cloning the tutorial repo and see if it repros there.
v
That would take some more time/thought, I think.
Just throw out all your actual classes except for one and make its sole content a
println("Hello World!")
or something, should it be more complex?
But yes, as I said, take the tutorial repo and compare. First step would of course be to look whether it repros for you with that
Btw. I just copied your build script as-is into a dummy project, let it sync and
src/main/kotlin
was immediately marked as source folder after the sync
b
Hmm.
Well, not sure where that leaves me. Thanks a lot for giving that a try and letting me know, @Vampire!
v
typo in directories? Maybe you called it
maln
or
ma1n
? or
sre
or whetever. That's why I wanted to see the full project and to see whether it works here. Or maybe you use some EAP version that has a bug? ....?
Is the Sync actually successful?
Is there something in the log file?
Or as a start, does it work with the original tutorial repo?
b
I'm messing with it now and it's not breaking the source directory, which is now making me think it was only happening when I made certain types of changes to the buildfile.
I'll watch for it happening again and pay attention to the change I made when it has issues.