for that specifically, `val root = js { message = ...
# javascript
a
for that specifically,
val root = js { message = { "Hello World!!" } }
? (import kotlinext.js.js)
r
Could you please explain how it doesn't work? Are you getting a compile error?
m
@araqnid thx for your response, should I include another lib in my gradle build file for that import? kotlin-js does not seem to include this)
which I’m getting through npm at the moment
although it’s just a convenience wrapper: you can get a fresh object by calling
js("{}")
and then just set arbitrary properties on it (as it is type dynamic)
m
OK, I tried that by adding
Copy code
"dependencies": {
    "@jetbrains/kotlin-extensions": "^1.0.1-pre.28",
to package.json via npm install -i
However when building I still get a
Main.kt: (3, 8): Unresolved reference: kotlinext
Note the page you mentiond also sya to run
npm run gen-idea-libs
but that gives me:
Copy code
$ npm run gen-idea-libs
npm ERR! missing script: gen-idea-libs
the
js("{}")
variant works btw
a
ah, I’m using a template based on create-react-kotlin-app, this is part of the myserious build system it creates, I guess
afaik gen-idea-libs is a help to auto-generate the .idea/libraries/*.xml files, so it’s just automatically some of the manual project structure setup (which tbh I’m wholly unfamiliar with, as intellij projects are usually just imported from Gradle for me)
but that config file it built is just a library config of type “kotlin.js” referencing file://$PROJECT_DIR$/node_modules/@jetbrains/kotlin-extensions/build/classes/main
for Gradle, it seems the recipe is:
Copy code
repositories {
    maven {
        url  "<https://dl.bintray.com/kotlin/kotlin-js-wrappers>"
    }
}

dependencies {
    compile 'org.jetbrains:kotlin-extensions:1.0.1-pre.28-kotlin-1.2.30'
}
with that, I was able to use the library in a stripped-down app without CRKA
well, I was able to get it linked in the IDE; seems it needs “core-js” at runtime
btw
@jetbrains/gen-idea-libs
is an npm package too, maybe just adding that would let you run it
although in fact react-kotlin-scripts is inserting some extra fun “dynamically find the Kotlin/JS libraries inside node_modules” stuff before actually calling it
m
thx a lot for you patience! I gonna try your suggestions
Yes, adding
compile("org.jetbrains:kotlin-extensions:1.0.1-pre.28-kotlin-1.2.30")
works! thx again!