What is the correct way to get the plugin configur...
# opensavvy
r
What is the correct way to get the plugin configuration? I can't see anything I set inside
vite {}
block.
Or is this just currently broken and that's why dependencies are not configured as well (https://gitlab.com/opensavvy/automation/kotlin-vite/-/issues/65) ?
c
The plugins you set yourself should be available via
vite { plugins... }
. The plugins applied be default will only be available on the
WriteConfig
tasks because KGP uses
afterEvaluate
:/
The blocker I have is supposedly fixed on Gradle 9 so I may be able to fix it after the upgrade
r
And how about simple options configured inside
vite {}
block? I've added new
autoRewriteIndex
option, but whatever I set in my buildfile, I just get the default value. I've tried
project.viteConfig
and some other variants, but nothing works (the value is visible but only inside
KotlinViteExec
task).
c
That's weird, I don't know at all what could be caused by that 🤔
Where did you add the option? In :vite-base or in :vite-kotlin?
Have you updated setDefaultsFrom? But if you haven't KotlinViteExec shouldn't see it either... Does the dump task see it?
r
I've added the option in vite-base
I've updated setDefaultFrom and added
autoRewriteIndex.convention(false)
in setDefaults
Now I just want to read the value inside
KotlinVitePlugin.apply()
and the value is always false.
c
^ btw, if my code is bad and there's a better way to do this with Gradle, don't hesitate to tell me, I'm gluing things together the best I can
r
I'm not a Gradle expert as well 🙂
c
Now I just want to read the value inside KotlinVitePlugin.apply() and the value is always false.
Ah that's normal, `apply()`runs when Gradle runs the `plugins {}`block, which is before it runs the build script Ideally you should only read properties during task execution, or during another property's initialization
💡 1