Vite in Maven Build/Package Process

Hi, I have developed a custom Vite Plugin that uses the transform-hook to transform a few files. I basically need this because Project 1 (my dependency, a Vaadin Addon - similar to this: has some JS files (that also comes from a Maven dependency) that needs to be transformed. So, right now I have this Plugin in my Main Vaadin Project that has Project 1 (the dependency) as a dependency. When I run mvn spring-boot:run I can see that Vite transform the files and it works fine. But I want to make this Plugin part of the Addon (Dependency-Project) since I don’t want to have this plugin in every Project that I have the Addon as a dependency. So my question is, is there any way to use this Plugin in my Dependency-Project and anytime I run mvn install Vite transform the files (run the Plugin) ?

Short answer: I don’t think so

Hm, okay. So I guess I have to somehow integrate it in the Maven workflow without Vite. But I guess that is possible, isn’t it? When I create a javascript file that is called and transforms the file?

The possibilities with maven / gradle plugins are literally endless if you know what you wanna do :sweat_smile:

If you add the plugin as a TS file in your add-on META-INF/frontend then the addon users should be able to use it in their vite.config.ts using something like

import {ThePlugin} from './frontend/generated/jar-resources/theplugin.ts'
const customConfig: UserConfigFn = (env) => ({
  plugins: [ThePlugin()]

There is no way to automatically inject it into the vite.config.ts though

That is a good idea! I just wanted to try it but I am a little bit confused. I cloned this Repo: and added the dependency in the .pom file. But when I run mvn spring-boot:run the vite.config.ts or node_modules folder is not created :thinking:

That is because of the dev bundle mode used by default in Vaadin 24. It uses a precompiled bundle so it does not have to install frontend tooling at all, including Vite

If you set ”vaadin.frontend.hotdeploy” to true, you will see the files

Ah, okay. Thank you!