Hi, I am new to KMM/Js. I have some KMM code being...
# javascript
a
Hi, I am new to KMM/Js. I have some KMM code being shared by Android & ios App via Maven & Cocoapod distribution. Is there any similar way to distribute the KMM code as JS to be used by existing JS project.
b
a
Thanks for your suggestion. I was wondering is there any first class plugin support provide by JetBrains just like Cocoapod or Maven plugin.
b
Unfortunately not. I've tried to get part npm-publish merged into kgp, but that didn't work out at that time
👍 1
a
Got it. Let me add more context to the question. I have a feature developed with KMP business logic and compose in App side codebase. I want to ship the same feature for web too and am thinking of reusing KMP business logic for that while keeping UI in web native. For such a use case, I would need to publish my KMP business logic to NPM so that UI native can consume that. Let me know if my use case and approach is right or if I am missing something here
b
Sounds about right
1
a
Hi @Big Chungus: I think there is some issue with the library while using with _useEsModules_() option for kotlin 1.9.0. It seems like when published using this option, javascript is not able to find the library import. All other things like .d.ts and package.json seems to be fine.
b
useEsModules() option is still experimental and as such not explicitly supported by the plugin. However I'd still appreciate a bug on the repo with steps to reproduce if you have time.
1
a
Hi @Big Chungus, were you able to check this? If you think that there is something wrong with my configuration, let me know. Also, I am just trying to use the
useEsModules()
option to get rid of the canonical name check from my JS code (see the example below). If there is any other alternative to achieve that, let me know
const jsKotlin = require('js-kotlin')
const jsWrapper = new jsKotlin.JsWrapper
const json = jsWrapper.getJsRespons((response) => {
if (response instanceof com.example.NetworkResult.Success ) {
const reponseData = response.data;
console.log("Success data:", reponseData);
}
})
b
Not yet, I'll try to find some time tomorrow
👍 1
a
@Big Chungus: Have you had a chance to check it?