3

I have a library written in Kotlin that I want to use from an Angular Webapp written in TypeScript, but I end up getting Uncaught Error: Error loading module 'js'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'js'.

I did npm install --save kotlin, but I'm not quite sure what to do with it, nor how to instatiate my RpnCalculatorService.

I did <script src="assets/kotlin/kotlin.js"></script> in my index.html, which works but feels very wrong, and import {RpnCalculatorService} from './MathLib/js'; doesn't yield any errors but I can't create a new service by calling new RpnCalculatorService().

Chris
  • 117
  • 7
  • I solved the "call koltin from angular" problems as described in this post. [building-applications-with-kotlin-and-typescript](https://medium.com/@dr.david.h.akehurst/building-applications-with-kotlin-and-typescript-8a165e76252c) basically, your approach with a script should work. Or you can add 'node_modules/kotlin/kotlin.js' to the angular.json scripts segment. Or you need to do a bunch of stuff (detailed) in my post in order to import kotlin using the typescript import statement. – user2228895 Jan 09 '20 at 12:21

0 Answers0