Skip to content

Conversation

@DynamicProdBreaker
Copy link

Kotlin/JS currently only supports 2 execution environments, node and browser. The former is for execution as an application on node, and the latter is for browser scripting on the client. To develop an application in Kotlin that compiles to JS, one needs to use the nodejs option in build.gradle.kts, but this has the caveat that it is very specific to node, building the application as an npm package and pulling in npm + npm dependencies and node itself, among other things. It comes with a lot of extra features and things that may not be desired if the goal is to compile Kotlin to plain JS that can work in a generic environment. To remedy this, I suggest adding a generic target for JS, which will build the project directly into plain, simple executable JS with nothing else included and which is not specific to node or npm. This of course comes with the downside that you can't really use npm with a generic target, but for applications where a minimal build output is desired, it is expected that dependencies would be other libraries written in Kotlin that will be built to yield JS, so this hopefully shouldn't be an issue.

This is a work in progress, and has not been completed yet, don't try to review it because it is not finished!

@JSMonk JSMonk self-requested a review January 29, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant