File was not included when creating the production bundle
Description of the bug
This bug I am getting since I updated my project to vaadin 24. The full error is:
ERROR c.v.f.component.internal.UIInternals - The component class com.vaadin.flow.component.textfield.TextArea includes '@vaadin/text-area/src/vaadin-text-area.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(TextArea.class) where it is used.\n
I tried using Uses annotation, JsModule annotation but nothing worked. I haven't extended TextArea for any component, I am using it inside a component.
Expected behavior
Should not get this error.
Minimal reproducible example
I don't know what to share because I don't get this error/log when I run it locally, I get this when it is running on an amazon linux machine
Versions
- Vaadin / Flow version: 24.3.10
- Java version: 17
- OS version: Sonoma 13.5
- Browser version (if applicable): chrome
- Application Server (if applicable): tomcat
- IDE (if applicable): intellij
Could you try to set optimizeBundle=false config parameter?
Please also try to delete src/main/bundles/ folder.
Also would be useful for us to have a minimal reproducible example. What do your logs say, does Flow build a new bundle or does it reuse a default/pre-compiled bundle ?
How to know if Flow build a new bundle or does it reuse a default/pre-compiled bundle ? I am getting only above mentioned error in logs, nothing else.
When building for production, you should see something similar on the console
[INFO] --- vaadin-maven-plugin:24.4.4:build-frontend (default) @ my-vaadin-app ---
....
[INFO] Checking if a production mode bundle build is needed
[INFO] A production mode bundle build is not needed
or
[INFO] --- vaadin-maven-plugin:24.4.3:build-frontend (default) @ spring-skeleton ---
...
[INFO] Checking if a production mode bundle build is needed
[INFO] Frontend import Frontend/my.js is missing from the bundle
[INFO] A production mode bundle build is needed
I got [INFO] A production mode bundle build is needed
Can you please run maven with -X flag and post the logs of the build-frontend goal?
<optimizeBundle>false</optimizeBundle> this worked. Thanks.