Kotlin JS client example: Gradle and npm


#1

Hi there,
I’m looking into building a web client (based on React) using Kotlin JS

So far I figured there are two possible approaches that people follow:

  1. Use Kotlin WebPack plugin - and don’t use Gradle
  2. Use Kotlin Front-end plugin for Gradle - and don’t use npm

Both seem a bit contrived in my opinion.

Is there any example which:

  • uses Gradle to compile Kotlin
  • uses npm to manage dependencies, bundle etc.

Side questions:

Thank you!


#2

kotlin-frontend-plugin uses NPM and allows to add custom dependencies.

There are no definitive plans regarding ES2015. Maybe. Could you describe why this would be beneficial for your use case?


#3

Looks like ES2015 is not used for client-side, so I don’t actually need it :slight_smile:

How about JSX, any plans to support that syntax?


#4

So which version of the dependencies will it use?

I feel it might work for a toy example, but not for a real-world project - trying to replicate full npm functionality in Gradle is just not practical. Kotlin Webpack plug-in seems a better way to go (haven’t tried it yet though)


#5

You should be able to specify a version and if you don’t it will automatically choose the latest


#7

I am pretty sure you can specify the version like so: dependency("kotlin", "1.1.0")

@cy6erGn0m should know more