Derek Wong
06/17/2022, 4:49 AMAdam S
06/18/2022, 7:57 PMbuild.gradle.kts
file but I'm getting an error in the application logs
<i> [webpack-dev-server] [HPM] Upgrading to WebSocket
<e> [webpack-dev-server] [HPM] WebSocket error: Error: read ECONNRESET
<e> at TCP.onStreamRead (node:internal/stream_base_commons:220:20) {
<e> errno: -4077,
<e> code: 'ECONNRESET',
<e> syscall: 'read'
<e> }
If I hardcode the websocket server URL to <ws://localhost:8080/ws>
of course it works - but I don't want to hard code it. I couldn't find any examples or documentation on this.
Has anyone managed to set up websockets with Kotlin/JS? What's the best practice?
I'm using Kotlin/JS 1.7.0 and KVision 5.10.1. More details in #kvision here and on StackOverflow hereRobert Jaros
06/21/2022, 12:38 PMjanvladimirmostert
06/21/2022, 7:58 PMDanilo Reinert
06/21/2022, 8:59 PMspierce7
06/23/2022, 1:49 PMspierce7
06/23/2022, 4:29 PMd.ts
files generated.
https://kotlinlang.org/docs/js-ir-compiler.html#preview-generation-of-typescript-declaration-files-d-ts
Is there something I have to do to enable this?salomonbrys
06/23/2022, 4:33 PMChildrenBuilder
(https://github.com/JetBrains/kotlin-wrappers/blob/master/kotlin-react/src/main/kotlin/react/ChildrenBuilder.kt), the ElementType<P>.invoke
function declares the generic bounds where P : Props, P : ChildrenBuilder
.
I can call this function inside a ChildrenBuilder
with, for example, ReactHTML.div.invoke {}
(here I put the invoke
to be explicit, even though it is not required).
Now, ReactHTML.div
is an IntrinsicType<HTMLAttributes<HTMLDivElement>>
, which is also an ElementType<HTMLAttributes<HTMLDivElement>>
, so the resolution kind of makes sense...
BUT I cannot find anywhere HTMLAttributes
implements ChildrenBuilder
, which should break the resolution of the ElementType<P>.invoke
function. The HTMLAttributes
interface implements AriaAttributes
, DOMAttributes
, PropsWithRef
, PropsWithChildren
, PropsWithClassName
, PropsWithStyle
, and Props
. How the hell can the Kotlin Compiler agrees that the where
clause of the ElementType<P>.invoke
function is satisfied ?!?!?
Furthermore, IntelliJ shows the invoke
"this" hint as ChildrenBuilder & HTMLAttributes<HTMLDivElement> & Props
, when, according to the invoke
function signature, it should simply display HTMLAttributes<HTMLDivElement>
. Where is the ChildrenBuilder
coming from ? What black magic is that ?!?
Oh, and when I ask IntelliJ to explicit the type argument to invoke
, it can't! It puts Any
, which clearly breaks the where
clause. If I try to set myself the type argument with div.invoke<HTMLAttributes<HTMLDivElement>>
, then IntelliJ tells me that "Type argument is not within its bounds", which I fully agree with!
Help me, please, I'm losing it 🙃 !Moritz Hofmeister
06/24/2022, 7:17 AMBig Chungus
06/24/2022, 1:14 PMspierce7
06/26/2022, 10:46 PMArkadii Ivanov
06/27/2022, 9:08 AMbrowser()
+ binaries.library()
and everything works fine. Now I'm trying to replace Compose with React (org.jetbrains.kotlin-wrappers:kotlin-react-dom
), and I'm getting the following runtime error:
Uncaught Error: Error loading module 'xyz'. Its dependency 'react-dom/client' was not found. Please, check whether 'react-dom/client' is loaded prior to 'xyz'.
If I use binaries.executable()
then there is another runtime error:
Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'"
Is there a way to distribute a Chrome extension with React dependencies?Alexander Sysoev
06/27/2022, 11:28 AM.js
file like this:
OuterClass.InnerClass = function(arg1, arg2) { ... }
export default p5.Element;
How can i write external declaration for it in kotlin, given that i already have OuterClass exported? Should it be like
external class OuterClass {
class InnerClass(arg1: Int, arg2: Int) {}
}
Can it be done outside OuterClass
class?mbonnin
06/28/2022, 10:47 AMkotlin-js-store
and kotlinNpmInstall
.
Is it possible to tell Kotlin 1.6 to use the 1.7 npm dependencies? Looks like no matter what I do, these dependencies are overwrittenandylamax
06/28/2022, 1:26 PMPlease make sure that you have installed browsers.
Or change it via
browser {
testTask {
useKarma {
useFirefox()
useChrome()
useSafari()
}
}
}
when running in IDE. But the tests are running fine when I run them in the terminal. Is this a known problem? I have a CHROME_BIN environment variable in my machineArkadii Ivanov
06/28/2022, 9:55 PMlibrary
that depends on e.g. org.jetbrains.kotlin-wrappers:kotlin-react-dom
, is there are way to automatically populate transitive NPM dependencies in package.json
? So that I can avoid adding implementation(npm("react-dom", "*"))
explicitly.Ayfri
06/29/2022, 8:43 PMorg.jetbrains.kotlin-wrappers:kotlin-js
and io.github.turansky.seskar:seskar-core:
, Idea is completely fine with it, but when I run tests, it can't find anything from these, my dependencies are set like this
api("io.github.turansky.seskar:seskar-core:${Versions.seskar}")
api("org.jetbrains.kotlin-wrappers:kotlin-js:${Versions.kotlinWrappers}")
testImplementation(kotlin("test-js", Versions.kotlin))
And Versions
is an object with const val
string properties defining the versions and is defined in my buildSrc
module.Matthias Geisler
06/30/2022, 5:07 PMChukwukammadu Anizoba
06/30/2022, 9:14 PMerror An unexpected error occurred: "<https://registry.yarnpkg.com/@types/eslint/-/eslint-8.4.4.tgz>: Request failed \"404 Not Found\"".
> Task :kotlinNpmInstall FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':kotlinNpmInstall'.
> Process 'Resolving NPM dependencies using yarn' returns 1
yarn install v1.22.10
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
Was able to run the project fine an hour ago. Any idea what could be causing this?alexcouch
06/30/2022, 10:45 PMBernhard
06/30/2022, 11:05 PMRenegade Master
06/30/2022, 11:57 PMxiaobailong24
07/01/2022, 11:17 AMErik
07/01/2022, 2:16 PMribesg
07/01/2022, 3:06 PMbrowser {}
. If I want to write a NodeJS server in Kotlin/JS, I use nodejs {}
.
But what do you use for “pure” libraries? What if I want to remake something like Moment.js from scratch? Or a simple algorithm implementation? It can be used both in the browser or in a nodejs server, it’s “just pure js”. How do you configure a project like that? Do you target one or the other, or both? Does it make a difference?Javier
07/02/2022, 8:32 PM> Task :library:compileTestKotlinJsIr FAILED
e: java.lang.StackOverflowError
at java.base/sun.nio.fs.WindowsNativeDispatcher.FindFirstFile(WindowsNativeDispatcher.java:195)
at java.base/sun.nio.fs.WindowsDirectoryStream.<init>(WindowsDirectoryStream.java:78)
at java.base/sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:535)
at java.base/java.nio.file.Files.newDirectoryStream(Files.java:482)
at org.jetbrains.kotlin.konan.file.File.getListFiles(File.kt:56)
at org.jetbrains.kotlin.library.impl.MetadataLibraryImpl$packageMetadataParts$1.invoke(KotlinLibraryImpl.kt:75)
at org.jetbrains.kotlin.library.impl.MetadataLibraryImpl$packageMetadataParts$1.invoke(KotlinLibraryImpl.kt:72)
at org.jetbrains.kotlin.library.impl.BaseLibraryAccess.inPlace(KotlinLibraryLayoutImpl.kt:71)
at org.jetbrains.kotlin.library.impl.MetadataLibraryImpl.packageMetadataParts(KotlinLibraryImpl.kt:72)
at org.jetbrains.kotlin.library.impl.KotlinLibraryImpl.packageMetadataParts(KotlinLibraryImpl.kt)
at org.jetbrains.kotlin.backend.common.serialization.metadata.impl.KlibMetadataDeserializedPackageFragmentsFactoryImpl.createDeserializedPackageFragments(KlibMetadataDeserializedPackageFragmentsFactoryImpl.kt:33)
at org.jetbrains.kotlin.serialization.konan.impl.KlibMetadataModuleDescriptorFactoryImpl.createPackageFragmentProvider(KlibMetadataModuleDescriptorFactoryImpl.kt:115)
at org.jetbrains.kotlin.serialization.konan.impl.KlibMetadataModuleDescriptorFactoryImpl.createDescriptorOptionalBuiltIns(KlibMetadataModuleDescriptorFactoryImpl.kt:72)
at org.jetbrains.kotlin.ir.backend.js.ModulesStructure.getModuleDescriptor(klib.kt:728)
at org.jetbrains.kotlin.ir.backend.js.ModulesStructure.getModuleDescriptor(klib.kt:738)
Reuben F
07/04/2022, 6:33 PMYakeen Sewsanker
07/05/2022, 1:24 PMbinary.library()
instead of binary.executable()
)?Ayfri
07/05/2022, 4:29 PMyarn.lock
on GitHub ?gbaldeck
07/05/2022, 8:40 PMgbaldeck
07/05/2022, 8:40 PMBig Chungus
07/06/2022, 1:49 AM