Tim Ortel
01/05/2022, 4:16 PMTim Ortel
01/05/2022, 4:21 PMturansky
01/05/2022, 4:55 PMVladyslav Sitalo
08/14/2022, 11:16 PMturansky
08/15/2022, 7:59 AMVladyslav Sitalo
08/16/2022, 5:55 AMVladyslav Sitalo
08/16/2022, 5:59 AMplugins {
kotlin("js") version "1.7.10"
}
...
dependencies {
...
implementation(npm("alfy", "1.0.0"))
...
}
kotlin {
js(IR) {
binaries.executable()
nodejs {
}
}
}
• alfy type definitions:
@JsModule("alfy")
@JsNonModule
external object alfy {
val input: String
fun output(items: List<AlfredResult>)
}
when compiled & trying to run I get the following error:
[22:50:30.733] ERROR: KAutocomplete the world[Script Filter] Code 1: node:internal/modules/cjs/loader:1148
throw err;
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/vlad/coding/knowledge/autocomplete-the-world-kt/build/js/node_modules/alfy/index.js from /Users/vlad/coding/knowledge/autocomplete-the-world-kt/build/js/packages/autocomplete-the-world/kotlin/autocomplete-the-world.js not supported.
Instead change the require of index.js in /Users/vlad/coding/knowledge/autocomplete-the-world-kt/build/js/packages/autocomplete-the-world/kotlin/autocomplete-the-world.js to a dynamic import() which is available in all CommonJS modules.
at /Users/vlad/coding/knowledge/autocomplete-the-world-kt/build/js/packages/autocomplete-the-world/kotlin/autocomplete-the-world.js:5:29
at Object.<anonymous> (/Users/vlad/coding/knowledge/autocomplete-the-world-kt/build/js/packages/autocomplete-the-world/kotlin/autocomplete-the-world.js:21:2) {
code: 'ERR_REQUIRE_ESM'
}
Node.js v17.5.0
turansky
08/16/2022, 6:57 AMwould appreciate a pointer to a specific example out of those packages!
will describe my problem below
kotlin-node
turansky
08/16/2022, 10:28 AMrequire
problem 🙂Vladyslav Sitalo
08/17/2022, 12:05 AMplugins {
kotlin("js") version "1.7.10"
}
and none of the other plugins in the package seem relevant?Vladyslav Sitalo
08/18/2022, 11:59 PMturansky
08/19/2022, 8:08 AMturansky
08/19/2022, 8:09 AMturansky
08/19/2022, 10:22 AM