Hello folks, is there any way to generate a js lib...
# multiplatform
s
Hello folks, is there any way to generate a js library from a kmm library project? I can generate the corresponding js file but it's... empty, this is my config
Copy code
js(IR) {
        binaries.executable()
        browser {
            commonWebpackConfig {
                outputFileName = "wpi.js"
                outputPath = File(buildDir, "outputs")
            }
        }
    }
and it generates
Copy code
(function (root, factory) {
  if (typeof define === 'function' && define.amd)
    define(['exports'], factory);
  else if (typeof exports === 'object')
    factory(module.exports);
  else
    root['wpi-wpi'] = factory(typeof this['wpi-wpi'] === 'undefined' ? {} : this['wpi-wpi']);
}(this, function (_) {
  'use strict';
  //region block: pre-declaration
  //endregion
  return _;
}));

//# sourceMappingURL=wpi-wpi.js.map
Artifacts for android and ios are correctly generated
b
you need to use binaries.library() for that. The js file is now empty because you have no entrypoint in a lib (and you shouldn't).
You'll also need to explicitly mark public api you want to export to js with @JsExport
s
Inside
commonMain
b
And jsMain if you have any js-only code
s
Ok thanks, I'll check it
Looks like there are some problems with the generics
b
Yep
Js export has limitations
s
Ok, so I'll move the task to next sprint haha
😆
b
Foolproof "fix" for any issue 😀 just kick it down the road
s
Yeah hahaha