flow: UI is broken when application is packaged using maven with production profile

Description of the bug

When I package an application using mvn clean package -P production, a page is not shown or shown with broken styles. In logs I see messages:

2024-10-14T16:06:10.233+03:00 ERROR 32784 --- [io-8080-exec-10] c.v.flow.component.internal.UIInternals  : The component class com.vaadin.flow.component.button.Button includes '@vaadin/button/src/vaadin-button.js' but this file was not included when creating the production bundle. The component will not work properly. Check that you have a reference to the component and that you are not using it only through reflection. If needed add a @Uses(Button.class) where it is used.
2024-10-14T16:06:10.233+03:00 ERROR 32784 --- [io-8080-exec-10] c.v.flow.component.internal.UIInternals  : The component class com.vaadin.flow.component.textfield.TextField includes '@vaadin/text-field/src/vaadin-text-field.js' but this file was not included when creating the production bundle. The component will not work properly. Check that you have a reference to the component and that you are not using it only through reflection. If needed add a @Uses(TextField.class) where it is used.
2024-10-14T16:06:10.233+03:00 ERROR 32784 --- [io-8080-exec-10] c.v.flow.component.internal.UIInternals  : The component class org.vaadin.example.TestView includes './views/my-view.ts' but this file was not included when creating the production bundle. The component will not work properly. Check that you have a reference to the component and that you are not using it only through reflection. If needed add a @Uses(TestView.class) where it is used.
2024-10-14T16:06:33.081+03:00 ERROR 32784 --- [nio-8080-exec-4] c.v.flow.component.internal.UIInternals  : The component class com.vaadin.flow.component.orderedlayout.VerticalLayout includes '@vaadin/vertical-layout/src/vaadin-vertical-layout.js' but this file was not included when creating the production bundle. The component will not work properly. Check that you have a reference to the component and that you are not using it only through reflection. If needed add a @Uses(VerticalLayout.class) where it is used.

Expected behavior

The application is packaged correctly and I can open pages.

Minimal reproducible example

See https://github.com/Tymur-Lohvynenko-Epicor/vaadin24-production-mode-bug, it is just starter with the one view that was added using Vaadin Designer.

Versions

  • Vaadin / Flow version: 24.4.13
  • Java version: 17
  • OS version: Windows 11
  • Browser version (if applicable): Google Chrome Version 129.0.6668.101 (Official Build) (64-bit)
  • Application Server (if applicable):
  • IDE (if applicable): IntelliJ IDEA 2024.2.3 (Ultimate Edition)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 20 (3 by maintainers)

Most upvoted comments

The configuration of the kotlin-maven-plugin must be put before the vaadin-maven-plugin, otherwise the build-frontend goal will not find the compiled kotlin classes, since they both run in compile phase.