I am working on my first my first vaadin-on-kotlin app and I’m having problems doing a production build with the very nice MediaQuery addon by @Jean-Christophe.1
In dev mode everything works, but for some reason it’s not included to final bundle.
Is there something special about using a local dependency compared to deps from repos? Addons from repos like leaflet are picked up.
Snip from my build.gradle.kts:
plugins {
kotlin("jvm") version "1.9.23"
kotlin("plugin.serialization") version "1.9.23"
id("com.vaadin") version "24.2.12" // tried also 24.3.7
}
dependencies {
// other deps removed
// leaflet addon works
implementation("com.xdev-software:vaadin-maps-leaflet-flow:4.0.1")
// mediaquery addon ignored on productionBuild
implementation(files("libs/mediaquery-5.0.3.jar"))
}
vaadin {
productionMode = true
}
What I was able to see from running tasks with --info:
On :compile mediaquery is on classpath
In :vaadinPrepareFrontend the js files from mediaquery.jar are placed to frontend/generated/jar-resources
But when :vaadinBuildFrontend runs the classpath to NodeTasks.Builder does not contain mediaquery-5.0.3.jar → js files don’t get scanned and included to generated-flow-imports.
I have never used that files syntax. Directory is bit weird for this JC’s add-on: it doesn’t show the custom repository it exists in. The leaflet add-on by XDEV is in central so that works out of the box
I tested with my yesterdays Kotlin webinar example an there it worked like this:
Are you sure you enabled the production mode for the build? Some add-ons work without the front-end build and that might be the case for the leaflet add-on as well . In my test project all worked fine with these commands from CLI:
The files() clause includes a dependency not from a repository, but rather from a filesystem; in this case from a folder libs/ committed to the git repository. :vaadinBuildFrontend not including this kind of dependency into classpath sounds like a bug in the Vaadin Gradle plugin. Could you please open a ticket at Issues · vaadin/flow · GitHub and attach a very simple Gradle project which reproduces the issue?