Blake Anderson
10/16/2022, 8:12 PMmain
is always exported regardless.
• Within a package, @JsExport works as expected (making sure any identifiers included are not mangled). However, any function not referenced is not included. Functions that are referenced at the root level but not themselves exposed (likely because they aren't referenced?) are still included. Unlike the root level, main
is not exported.
In hindsight, it seems like the issue here is that functions are only included in the output if 1) they're referenced, or 2) they're the root main (rather than being an issue with @JsExport). Is this intended? How can I force the output to include these functions for the purpose of a library?andylamax
10/16/2022, 8:42 PM@JsExport
. Do not expect that it will transitively export other definitions that have been referenced by the exported function, but it would be cool if it wereBlake Anderson
10/16/2022, 8:44 PMandylamax
10/16/2022, 8:46 PM@JsExport
is correctly being exported, regardless of being referenced or not. How does your typescript definition file look like? does it have those functions?Blake Anderson
10/16/2022, 8:47 PMBlake Anderson
10/16/2022, 8:51 PMeval
function is referenced from main
defined in the root package, while unreferenced
isn't.Blake Anderson
10/16/2022, 8:51 PMeval
is present, but unreferenced
isn't.andylamax
10/16/2022, 9:12 PMWhere would I have a typescript definition file?check in top level
build/js/packages
Blake Anderson
10/16/2022, 9:15 PMandylamax
10/16/2022, 9:15 PMdev.rhovas.interpreter.unreferenced()
throw?Blake Anderson
10/16/2022, 9:17 PMpublic fun unreferenced(): kotlin.Unit { /* compiled code */ }
andylamax
10/16/2022, 9:20 PMbinaries.executable()
or binaries.library()
in place, you should have a subfolder build/js/packages/<project-name>/kotlin
and your typescript definitions would be in.?
I like to use the typescript definition because it does tend to help you know how our definitions are exportedBlake Anderson
10/16/2022, 9:24 PMbinaries.executable()
(will paste build.gradle after this), but no change.Blake Anderson
10/16/2022, 9:26 PMbuild.gradle
. Sidenote; I'm not using the js(IR)
version here - with that the entire distributions
folder isn't generated; haven't gotten around to tracking that issue down yet. It seems unrelated but you never know.Blake Anderson
10/16/2022, 9:26 PMandylamax
10/16/2022, 9:32 PMjs {
// . . .
}
to
js(IR) {
// . . .
}
Blake Anderson
10/16/2022, 9:32 PMandylamax
10/16/2022, 9:33 PMandylamax
10/16/2022, 9:34 PMbinaries.executable()
lineBlake Anderson
10/16/2022, 9:35 PMBlake Anderson
10/16/2022, 9:35 PMBlake Anderson
10/16/2022, 9:38 PMBlake Anderson
10/16/2022, 9:39 PMtasks.named<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile>("compileKotlinJs").configure {
kotlinOptions.moduleKind = "plain"
}
andylamax
10/16/2022, 9:43 PMBlake Anderson
10/16/2022, 9:43 PMandylamax
10/16/2022, 9:44 PM