Is there a Gradle dsl function to set the `kotlin....
# javascript
h
Is there a Gradle dsl function to set the
kotlin.js.ir.output.granularity
?
e
Nope. The Gradle plugin's field is readonly and the value is taken from the properties only
Copy code
binaries.withType<JsIrBinary>().configureEach {
  linkTask.configure {
    outputGranularity
    ...
Worth making it configurable via DSL tho, I agree
1
h
Yeah, already notice it, very sad. To my surprise IDEA is able to find the declaration of the prop name in the KGP source code. And looking at the file, the PropertiesProvider does not expose the Gradle `Provider`s but the underlying type.
✔️ 1
e
YouTrack issue?
e
Upvoted, thanks!
i
Hi, thank you. In fact I think that compiler should work only in one mode (and probably it should be es-modules per-file as the most flexible). And then if you need one big bundle, you can use webpack output, which bundled all files together. What do you think about it? Or you have some specific case when you need exactly one file as compiler output?
e
@Ilya Goncharov [JB] you mean a single non-configurable mode? I think the less Webpack the better. It's better also for Kotlin going forward imo, as it being contained in a single place it is also easier to swap with something else if necessary
i
you mean a single non-configurable mode?
Yes By webpack, I does not mean webpack exactly, but any bundler IMHO compiler can just output standard js project with multiple files and ES modules. And then they can be bundled via webpack/rollup/etc. So Kotlin/JS looks like black box which has input as Kotlin files, and just output as JS files, and then they can be consumed by any JS tooling.
e
Mmm, I get it. However one of the appeals of K/JS is simplicity. If you start asking a JVM dev to setup a custom bundler you'll get a resignation letter 😂 But jokes apart, I quite like the current configurability of the K/JS compilation. Not sure if @hfhbd wants to add something on this topic.
😄 2
I'm open to any option btw. My main concern is keeping compatibility with CommonJS and Node.js versions that are not the shiny latest. Concrete example: IIRC zOS supports Node.js up to v16.x
h
Well, I already add my use-case to the issue. I am also primarily a JVM developer, so I don't care about which bundler is used, if any at all. For my use-case, the js script engine (Rhino 1.7R4), I just need 1 plain js file with a top-level function without ES modules/exports etc, like I would write plain JS files in the browser long time ago. For me, the resulting size doesn't matter.
🙏 1
I created the issue only to have a DSL option to not require a property. Changing the current behavior wasn't in the scope of my ticket.
e
Yeah we probably went off topic, but I wanted to clarify with @Ilya Goncharov [JB] my opinion on what he had asked
h
I'll never stop an ongoing discussion, especially about Kotlin. I just want to not merge the issue about the missing dsl issue from changing the current behavior 🙂
But talking about our real use-cases will definitely help Kotlin/JS team to understand our needs.