Comments (5)
This is the main reason: https://youtrack.jetbrains.com/issue/KTOR-1084/Kotlin-JS-Ktor-client-adds-too-much-size-to-a-compiled-JS-file
from kvision.
I did some tests and this seems not an issue now.
the size of my bundle.js is:
2 032 KB my own project without modifications (with kvsion stuff, kotlinx-datetime, kotlin-serialization)
2 338 KB after creating empty ktor Client
2 362 KB after adding auth and configuration of basic auth
2 444 KB after defining cookies and cache and Charsets
2 479 KB after installing logging
my methodology
requirements:
windows 10
kotlin = 2.0.0-Beta4
kvision = 7.4.3
ktor client = 2.3.9
gradle wrapper = 8.6
gradle command
.\gradlew clean jsBrowserDistribution
the added script looks like this
private suspend fun createFuss() {
val client = HttpClient(Js) {
install(Auth) {
basic {
credentials {
BasicAuthCredentials(username = "jetbrains", password = "foobar")
}
realm = "Access to the '/' path"
}
}
install(HttpCookies) {
storage = ConstantCookiesStorage(Cookie(name = "user_name", value = "jetbrains", domain = "0.0.0.0"))
}
install(HttpCache)
Charsets {
register(Charsets.UTF_8)
register(Charsets.ISO_8859_1, quality = 0.1f)
}
install(Logging)
}
}
gradle dependencies
...
val ktorVersion = "2.3.9"
implementation("io.ktor:ktor-client-js:$ktorVersion")
implementation("io.ktor:ktor-client-logging-js:$ktorVersion")
implementation("io.ktor:ktor-client-auth:$ktorVersion")
...
and here are imports I've added
import io.ktor.client.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.client.plugins.*
import io.ktor.client.plugins.logging.*
import io.ktor.client.engine.js.*
import io.ktor.client.plugins.Charsets
import io.ktor.client.plugins.auth.*
import io.ktor.client.plugins.auth.providers.*
import io.ktor.client.plugins.cache.*
import io.ktor.client.plugins.cookies.*
import io.ktor.http.*
import io.ktor.utils.io.charsets.*
...
other test
did the test with this too, and my bundle.js is 422 KB so it's pretty decent.
What do you think? Are the tests valid for KVision?
from kvision.
In general nothing stops you from using Ktor client. KVision REST client is totally optional. If you prefer Ktor and don't mind a bit larger bundle size, you can use it without any problems. So the question is - what kind of integration do you think of?
from kvision.
I thought it would enable more feature out of the box and limit those that are actually duplicated like rest api calls. Since it is Jetbrains, this will get official support and in the end it should be easier to maintain.
from kvision.
But KVision doesn't use rest api calls internally. So there is nothing to replace. Of course we could drop kvision-rest module, but it would only break compatibility with existing apps.
The fullstack interfaces are based on fetch api directly and it would be probably to complicated to use ktor client instead.
So in the end I think currently there is nothing to do with this issue. Everyone is free to use Ktor client with KVision apps.
from kvision.
Related Issues (20)
- request url of KVService is using related path instead of absolute path HOT 2
- Tabulator vertical scrolling issue HOT 7
- Initial value for DateTime control HOT 1
- Request - support for crossorigin attribute in Image (and others) HOT 1
- Ability to intercept image load errors HOT 2
- Component lifecycle HOT 6
- StackPanel seems to not indexing components properly HOT 4
- Wrong module in kvision.gitbook.io. HOT 1
- trying to generate .pot files HOT 12
- overrides of `SimplePanel.AddAll` call refresh outside of a `singleRender` wrapper. HOT 1
- Allow KVService to have arguments with GET HOT 6
- Allow modifying response headers for Spring Boot and Micronaut apps HOT 1
- remove id parameter on get requests HOT 1
- Can't get data from Tabulator.RowComponent HOT 2
- Expandable/collapsible fieldset or panel HOT 2
- How to attch files using the Richtext Component HOT 7
- duplicated different word in kvision docs HOT 1
- can't make tabulator selectable with kvision v7.4.4 HOT 2
- My tabulator not selecting data HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kvision.