Kolin Multiplatform Targets NodeJS

Submitted by Dickens A S on Sat, 08/08/2020 - 12:13

Code written in kotlin will get transformed to JavaScript NPM module which can be executed directly from Node.JS

GitHub https://github.com/dickensas/kotlin-gradle-templates/tree/master/js-nodejs

Simple Kotlin code

fun main() {
   println ("hello")

The package.json which is manually created at root folder of the project

 "private": true,
 "workspaces": [
 "devDependencies": {},
 "dependencies": {},
 "peerDependencies": {},
 "optionalDependencies": {},
 "bundledDependencies": [],
 "name": "js-nodejs",
 "version": "1.0.0",
 "scripts": {
  "start": "node build\\js\\packages\\js-nodejs\\kotlin\\js-nodejs.js"

build\\js\\packages\\js-nodejs --- this js-nodejs will change if you have a different project name


 NodeJS Execution from command prompt

C:\js-nodejs>npm start

> js-nodejs@1.0.0 start C:\js-nodejs
> node build\js\packages\js-nodejs\kotlin\js-nodejs.js

hello test1


Add new comment