vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
589 stars 164 forks source link

Reducing vaadin.whitelisted-packages should trigger re-build of front-end development bundle #18839

Open bernhard-1 opened 4 months ago

bernhard-1 commented 4 months ago

Description of the bug

When the application property vaadin.whitelisted-packages is reduced, the front-end development bundle is not automatically rebuilt. This leads to the situation, that an erroneous change to vaadin.whitelisted-packages has no immediate impact. Instead the erroneous behaviour becomes only visible e.g. after some completely unrelated change in a css-file.

Expected behavior

Every modification of vaadin.whitelisted-packages should immediately trigger a rebuild of the front-end development bundle.

Minimal reproducible example

Run apexchartsdemo as spring boot application -> graphs are shown in browser Change vaadin.whitelisted-packages to "none" -> application is restarted and graphs are still visible Delete src/main/bundles and target/dev-bundle and restart application -> graphs are no more visible

Versions

caalador commented 4 months ago

This would be expected as the bundle may contain more than needed, but not be missing required packages. the list only defines what we packages we should scan for frontend file annotations and having an app bundle with required parts will not trigger generation of a new one if packages are removed as the bundle is not an optimisation, but a dx feature that makes startup faster by not requiring npm and vite execution for everything.

For a production build the flag vaadin.force.production.build can be set to always generate a new optimized production build even if a bundle would exist.

Legioth commented 4 months ago

I guess this goes both ways. If you add some new functionality in a package that isn't included, then you will believe it's broken if it isn't automatically picked up when you change the configuration to include the new package.

caalador commented 4 months ago

That is a problem when running the application class with accepted packages marked wrong. We only use block-list to skip packages by default to not come upon this issue. Also the list does not affect maven or gradle run builds (e.g. production build)

(edit) So yes if you fix the package setup so that a new frontend import or file is found that is not in the bundle then the bundle would be rebuilt as it doesn't contain the required parts. So too much data is fine, but missing parts require rebuild.