Piotr Krzemiński
11/22/2022, 2:55 PM:rest:model
and the other one :domain:model
I depend on both in a certain third Kotlin/JS project, and getting an error duplicate target file will be created
from processDceKotlinJs
. One of the solutions seems to be setting different names for JS bundles (like rest-model
and domain-model
). How can I customize the bundle names? I’m looking around Gradle DSL kotlin { js { … } }
but so far didn’t find itShubham Singh
11/26/2022, 7:23 AMRobert Jaros
11/27/2022, 9:00 AMDirk
11/28/2022, 12:07 PMspierce7
11/28/2022, 10:08 PMBig Chungus
11/29/2022, 3:15 PMCould not load content for <webpack://sandbox/util.kt> (Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME)
Mark Vogel
11/29/2022, 5:47 PMnpm run-script build
(i.e. react-scripts build
).
Does anyone know a way for Gradle to compile the React JavaScript code in my JS module and then use that compiled code as the dependency to include and interop?eygraber
11/30/2022, 8:58 AM92% sealing asset processing TerserPlugin
when running browserProductionWebpack
? I'm hoping the issue is that it just takes a long time to run, and if so, is there any way to speed it up (give it more RAM, etc...)?spierce7
11/30/2022, 4:55 PM<root project>/build/js
folder, and then manually run the js file in the packages/<app name>/kotlin/<app name>.js
? I'm curious if there is a nicer way to package everything up.Mike Dawson
11/30/2022, 7:10 PMSlackbot
12/01/2022, 3:20 AMKonyaco
12/01/2022, 4:06 AMimplementation(npm("@tauri-apps/api", "1.2.0", true))
But I got lots of compilation error in lib.dom.kt
(Prcture 1), which is converted from tsstdlib
ts library.
I think we just need the invoke()
function defined in tauri (Picture 2), so I tried to set generateExternals
to false
and manually add external definition in my Main.kt
, then the Tauri console tells me "cannot found xxx function."
What is the recommended way to use tauri in k/js?Shubham Singh
12/01/2022, 5:17 PMBrowserRouter
working on my codebase. So I have created a new Kotlin/JS app and the only change I have made in the code is instead of directly rendering the welcome
screen, I am loading it inside a BrowserRouter
Like this:
createRoot(container).render(
BrowserRouter.create {
Routes {
Route {
path = "/login"
element = welcome
}
Route {
path = "*"
element = VFC { +"404 Not found!" }.create()
}
}
}
)
Now, the problem with the output of this code is that if I type <http://localhost:8080/login>
in my browser, it gives me the following error: Cannot GET /login
. Following are the only two entries I see in the console:
1. failed to load resource: the server responded with a status of 404 (Not Found)
2. DevTools failed to load source map: Could not load content for <chrome-extension://fjdmkanbdloodhegphphhklnjfngoffa/lib/browser-polyfill.min.js.map>: System error: net::ERR_BLOCKED_BY_CLIENT
Now the interesting thing is that, instead of a BrowserRouter
, if I use a HashRouter
and instead of entering <http://localhost:8080/login>
, I enter <http://localhost:8080/#/login>
in my browser, the same code starts working perfectly fine 👍 So I am not sure what changes do I need to make in order for the BrowserRouter
to work fine.
Any help would be greatly appreciated.Racka N
12/01/2022, 8:09 PMkotlin-wrappers
BOM then added the MUI showcase sample. Now it compiles (using :browserDevelopmentRun
) and opens on the correct localhost but it's blank. Nothing is showing up on the browser. It used to work perfectly in the past.
Project: https://github.com/racka98/Kotlin-JS-Glass-UIPrabin Timsina
12/02/2022, 4:29 PMnpm install react-bootstrap bootstrap
and the module is installed in build/js/node_modules/bootstrap
.Prabin Timsina
12/03/2022, 4:29 PMjsBrowserDevelopmentRun --continuous
. (I also have ktor server running alongside)
build.gradle
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.7.21'
id 'application'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.7.21'
}
def ktorVersion = "2.1.3"
group = 'me.developer'
version = '1.0-SNAPSHOT'
repositories {
jcenter()
mavenCentral()
maven { url '<https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven>' }
}
kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = '1.8'
}
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
js() {
binaries.executable()
browser {
commonWebpackConfig {
cssSupport.enabled = true
devServer?.port = 8080
}
}
}
// dependencies {...}
}
application {
mainClassName = 'me.developer.application.ServerKt'
applicationDefaultJvmArgs = ["-Dio.ktor.development=true"]
}
tasks.named('jvmProcessResources') {
def jsBrowserDistribution = tasks.named('jsBrowserDistribution')
from(jsBrowserDistribution)
}
tasks.named('run') {
dependsOn(tasks.named('jvmJar'))
classpath(tasks.named('jvmJar'))
}
Eugene Maksymenko
12/04/2022, 11:50 PMLuca
12/05/2022, 5:01 AMcoroutineScope {
storeListItems.forEachIndexed { i, item ->
launch(Dispatchers.Default) {
val price = api.getPurchasePrice(item.id)
storeListItems[i] = StoreListItem(item, price)
stateManager.updateScreen(StoreListState::class) {
it.copy(
storeListItems = storeListItems,
)
}
}
}
}
where I have to fetch the prices of many store items with a separate api call for each store item by their id.
Additionally, chrome will update the screen as I expect (the order in which the prices get updated happens progressively) while firefox doesn’t seem to be handling the concurrency correctly and it updates the screen all at once)Mark Vogel
12/06/2022, 4:47 PM<link rel="stylesheet" href="<https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css>">
<link rel="stylesheet" href="path/to/bootstrap/dependency/dist/css/bootstrap.min.css"> <!-- to something like this -->
I just can't seem to figure out the correct path to point to the Gradle/NPM dependency; hopefully it's possible haha
Appreciate the help!eygraber
12/07/2022, 1:19 AMinternal actual fun ByteArray.putBytesInto(array: IntArray, offset: Int, length: Int): Unit =
TODO("implement js ByteArray.putBytesInto()")
The jvm implementation is:
internal actual fun ByteArray.putBytesInto(array: IntArray, offset: Int, length: Int) {
ByteBuffer.wrap(this)
.order(ByteOrder.LITTLE_ENDIAN) // to return ARGB
.asIntBuffer()
.get(array, offset, length)
}
Would the following be a correct implementation (even if not optimal):
internal actual fun ByteArray.putBytesInto(array: IntArray, offset: Int, length: Int) {
val byteBuffer = Uint8Array(this.toTypedArray()).buffer
val intArray = Int32Array(byteBuffer, offset, length)
for(i in 0 until intArray.length) {
array[i] = intArray[i]
}
}
Prabin Timsina
12/07/2022, 4:07 AMconst Input = () => {
return <input placeholder="Your input here" />;
};
1. My attempt which does not render anything when method is called:
fun input(): ReactElement<Props>? {
return createElement {
ReactHTML.input {
this.attrs.placeholder = "Your input here"
}
}
}
2. Also tried this github example but no success: https://github.com/Kotlin/react-redux-js-ir-todo-list-sample/blob/master/src/main/kotlin/reactredux/components/Link.kt#L12spierce7
12/07/2022, 3:57 PMlouiscad
12/09/2022, 12:30 AMGordon
12/10/2022, 9:00 PMWukongRework.exe
12/12/2022, 12:05 AMfoo?.bar?.baz
the code generated is (tmp$ = foo != null ? foo.bar : null) != null ? tmp$.baz : null
. This feels unnecessary as there are multiple null
checks. Couldnt an alternative be foo == null ? null : (foo.bar == null ? null : foo.bar.baz)
? this removes all the extra != null
checks. If there is some reason for this that I am unaware, please let me know. Thanks in advance for the clarificationDmitriy Malayev
12/12/2022, 5:00 PMspierce7
12/17/2022, 3:35 PMandylamax
12/17/2022, 4:49 PMnodejs
target?? if so, won't the name be confusing??
Whats the plan of supporting this??spierce7
12/17/2022, 10:30 PM<root project>/build/js
dir and putting it in the docker container.
The problem is that this folder contains EVERY single library that any project in my entire workspace touches. So my docker image is 400 MB, when it only needs to be 20 or 30 MB.
Is there any way to JUST package exactly the used dependencies?Anant Kumar Gupta
12/19/2022, 2:20 PM