I want to rephrase my problem stated above a littl...
# javascript
r
I want to rephrase my problem stated above a little bit. After some messing around I realized with initial create-react-kotlin-app setup js files are just ignored and simply not included into final build, which was likely the main issue. Since I want to use both JS and Kotlin in one project I want to be able to compile both js files and kt files. Unfortunately, I wasn't able to find any information how such system can be setup easily. I found kotlin plugin for webpack but I wan't able to set it up and there is not much information online about it. So, my question is, how to compile both kotlin files and js files in one react project (which uses create-react-app) if I have no intention to actually use react from kotlin, but want to be able to partially write application in kotlin and call it from js part?
a
I read this problem and skipped it since my application of kotlin/js is to never use it with js but the other way around. Either way, looks like at the moment, I am all you have got and I will do my best to provide the necessary help
1. You have a custom requirement. So, I suggest moving away from create-react-kotlin-app & create-react-app to gradle
2. If you strongly wanna stick with create-react-app. There might be a way. But you should get your hands dirty with gradle for kotlin side
That being said. The best process that I have for you right now is 1. You are going to have to setup gradle to compile your kotlin files 2. You are going to write an npm script that will first build kotlin, then go on to run javascript 3. You shouldn't forget to configure webpack to resolve modules from kotlin's outputs
r
Well, I spent almost the whole day on this problem and managed to get it to work somehow. I created basic CRA project, ejected it, added kotlin-webpack-plugin and kotlin packages and configured kotlin-weback by trial and error. And it seems to work now, just didn't manage to setup hot reloading for kotlin yet.
a
Wooow. Congrats man