API to inject Custom Vite Plugin into Flow dev server
Describe your motivation
We need to add Vite plugins to Flow in order to get information or create a dev server for Copilot. The current implementation requires moving the plugin into flow repository under the plugins folder so https://github.com/vaadin/flow/blob/main/flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskInstallFrontendBuildPlugins.java can collect plugins while building the frontend.
This is not the correct way due to the following reasons:
- A bug in a plugin can affect users even though Copilot dependency is excluded
- The plugin should stay in the project where it is owned as it can be found and develop easily.
- When we want to create tests for such a plugin, we might require some functionalities in the relevant project. It does not seem possible in Flow, as all plugins are tested via ViteIT
Describe the solution you'd like
A dedicated API that allows adding plugin through DevToolsInterface would be great to have.
Describe alternatives you've considered
If the solution above is not possible because Node task is running in a Mojo for build-frontend but the proposed solution is running at runtime, another solution would be to set a folder explicitly as a property to build-frontend task that enables adding plugins from external sources