I have been looking forward on how to create a kotlin-react-app using gradle (I am aware with the create-kotlin-react-app CLI tool, which doesn't use radle) and i couldn't get any sources to point me through. I have stumbled accross the kotlin frontend plugin (It works) and the npm and webpack plugin, but I couldnt configure them to run/create me a kotlin-react-project. I not an expert in configuring webpack so it probably even harder for me.
Initial Intentions
I intend to create a multiplatform project (yes, the kotlin experiental packed up in IntelliJ)
Alternative Approach
when I failed, I choose to go with this approach.
- Write my code using kotlin multiplatform plugin
- Compile it into a jar
- Add it as a library into the create-react-kotlin-app i'd create
- Run and wait for the magic to happen (it ddnt) Turns out, some how the preconfigured webpack wasn't compiling because it wasn't available during compile time. but the IDE worked well and even provided code compleion
Can someone please point me in a direction?
Building a react app using gradle is easy when using the kotlin frontend plugin. In IntelliJ,follow these steps
New module > gradle > kotlin (Javascript) > [next,next,next...finish]
You'll have to configure gradle ofcourse (based how you like it).
I configured mine as shown below:-
Hope this helps you.
Happy Hacking