flow icon indicating copy to clipboard operation
flow copied to clipboard

File was not included when creating the production bundle

Open avdhootu27 opened this issue 1 year ago • 5 comments

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

avdhootu27 avatar Jun 25 '24 10:06 avdhootu27

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 ?

mshabarov avatar Jul 02 '24 10:07 mshabarov

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.

avdhootu27 avatar Jul 03 '24 09:07 avdhootu27

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

mcollovati avatar Jul 03 '24 09:07 mcollovati

I got [INFO] A production mode bundle build is needed

avdhootu27 avatar Jul 03 '24 09:07 avdhootu27

Can you please run maven with -X flag and post the logs of the build-frontend goal?

mcollovati avatar Jul 03 '24 15:07 mcollovati

<optimizeBundle>false</optimizeBundle> this worked. Thanks.

avdhootu27 avatar Jul 05 '24 05:07 avdhootu27