LeoColman
07/14/2020, 11:11 PMkotlin {
js(IR) {
nodejs()
binaries.executable()
}
}
as my setup, and when running build
it outputs a JS file to build/js/packages/...
, but files from resources
are nowhere to be found over there. What's the proper way to generate a executable file that works on its own?turansky
07/14/2020, 11:15 PMjs
dist for now:
1. Use browser()
instead of node()
2. Use build/distributions/
as dist sourceLeoColman
07/14/2020, 11:23 PMLeoColman
07/14/2020, 11:23 PMLeoColman
07/14/2020, 11:25 PMPlease note that since this is only a preview, they are not added to thefolder by default for nowdistributions
LeoColman
07/14/2020, 11:25 PMturansky
07/14/2020, 11:45 PMLeoColman
07/14/2020, 11:45 PMLeoColman
07/14/2020, 11:46 PMturansky
07/14/2020, 11:47 PMM3
resources copied automaticallyturansky
07/14/2020, 11:48 PMsrc/main/resources
turansky
07/14/2020, 11:49 PM./gradlew clean
before to refresh Kotlin/JS settingsturansky
07/14/2020, 11:50 PMLeoColman
07/14/2020, 11:52 PMLeoColman
07/15/2020, 12:02 AMLeoColman
07/15/2020, 12:02 AMgradlew build
won't carry the file in resources to the package directoryturansky
07/15/2020, 12:03 AMbuild/distributions
dir of subprojectturansky
07/15/2020, 12:04 AMbrowser()
required instead https://github.com/LeoColman/KotlinJSM3/blob/master/build.gradle.kts#L10LeoColman
07/15/2020, 12:37 AMturansky
07/15/2020, 12:46 AMnode
is just limited browser
turansky
07/15/2020, 12:49 AMLeoColman
07/15/2020, 12:57 AMLeoColman
07/15/2020, 1:02 AMbrowser
uses window
, which is not defined in a node environmentLeoColman
07/15/2020, 1:02 AMIlya Goncharov [JB]
07/15/2020, 7:49 AMnodejs
doesnât have its own bundle task, if you need some resources you can manually copy it
If you use browser
there is way to make it possible to run in Node.JS environment, you need change configuration for webpack in webpack.config.d
. You need to create this folder in your project and create any js
file with content
config.output = config.output || {}
config.output.globalObject = âthisâ
It will be fixed in 1.4.20 (https://youtrack.jetbrains.com/issue/KT-40159)