Skaldebane
10/23/2024, 7:34 PMiosApp
folder) and it just works.
Any help would be appreciated!Nestor Ledon
10/24/2024, 12:16 AMcomposeApp
. You'll want to make a shared
module with virtually all the same platform folders, code, and build.gradle. Make sure you see include(":shared")
in settings.gradle.kts
. If everything is green you should be able to build a JS module with the kotlin browser task jsBrowserProductionWebpack
. There's some more tweaking you'll have to do but that should get you started. Your js block should look something like this:
kotlin {
js(IR) {
moduleName = "shared"
useEsModules()
browser {
commonWebpackConfig {
outputFileName = "shared.js"
}
testTask {
useKarma {
useChromeHeadless()
}
}
}
compilations["main"].packageJson {
customField("types", "kotlin/shared.d.ts")
}
generateTypeScriptDefinitions()
binaries.executable()
}
If you do not plan on using WASM I would remove it from the project completely or it will cause you tons of headaches when pulling in dependencies. If you get it working you could publish your lib as an npm dependency and consume it in your web project.Nestor Ledon
10/24/2024, 1:17 AMcomposeApp
. Check this out.Skaldebane
10/24/2024, 1:22 AMSkaldebane
10/24/2024, 1:24 AMNestor Ledon
10/24/2024, 1:34 AMnpm i ~/your-proj/build/js/packages/composeApp
Skaldebane
10/24/2024, 1:35 AMSkaldebane
10/24/2024, 2:17 AMSkaldebane
10/24/2024, 2:22 AM@file:JsExport
, but thankfully I noticed this post on #C0BJ0GTE2, where these guys automated that with a Compiler plugin!
https://kotlinlang.slack.com/archives/C0BJ0GTE2/p1728813912690449Nestor Ledon
10/24/2024, 2:56 PM