vaadin / flow

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

UI is broken when application is packaged using maven with production profile #20246

Open Tymur-Lohvynenko-Epicor opened 1 week ago

Tymur-Lohvynenko-Epicor commented 1 week ago

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

Legioth commented 1 week ago

Duplicate of https://github.com/vaadin/flow/issues/19633

Legioth commented 1 week ago

Or maybe not exactly the same since the use of Kotlin might have an impact here.

mcollovati commented 1 week ago

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.