Grid component not visualize in production mode but show in development mod

I have this problem that is driving me crazy. When I compile the application in production mode the Grid components are not displayed, but when I compile in development it is.

I am using vaadin 14 and spring boot.

I found a workaround. In production mode, the vaadin maven plugin performs an optimization where it only copies the components it finds. For some reason it does not find the grid and does not include it. In order to avoid this, you must use the “optimizeBundle” plugin property with the value “false”

Example

<plugin>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-maven-plugin</artifactId>
    <version>${lib.vaadin.version}</version>
    <configuration>
        <optimizeBundle>false</optimizeBundle>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>prepare-frontend</goal>
            </goals>
            <phase>compile</phase>
        </execution>
    </executions>
</plugin>

Hi.

If you have a minimal project where the issue is reproducable would you
mind making a [ticket]
(https://github.com/vaadin/flow/issues/new) so that it can be fixed for the production build.

  • Mikael

Rodrigo Serra:
I found a workaround. In production mode, the vaadin maven plugin performs an optimization where it only copies the components it finds. For some reason it does not find the grid [MCDVOICE]
(https://www.mcdvoice.reviews/) and does not include it. In order to avoid this, you must use the “optimizeBundle” plugin property with the value “false”

Example

<plugin>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-maven-plugin</artifactId>
    <version>${lib.vaadin.version}</version>
    <configuration>
        <optimizeBundle>false</optimizeBundle>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>prepare-frontend</goal>
            </goals>
            <phase>compile</phase>
        </execution>
    </executions>
</plugin>

Exactly what I needed! You just saved me several hours. Thanks!

Thank you Rodrigo,
You saved my life!
I’m on Vaadin 14.3.4 and I had the same issue with Textarea, ComboBox and Upload (flow).
No problem when running locally but in production mode.


		<profile>
			<!-- Production mode is activated using -Pproduction -->
			<id>production</id>
			<properties>
				<vaadin.productionMode>true</vaadin.productionMode>
			</properties>
			<dependencies>
				<dependency>
					<groupId>com.vaadin</groupId>
					<artifactId>flow-server-production-mode</artifactId>
				</dependency>
			</dependencies>
			<build>
				<plugins>
					<plugin>
						<groupId>com.vaadin</groupId>
						<artifactId>vaadin-maven-plugin</artifactId>
						<version>${vaadin.version}</version>
						<configuration>
							<optimizeBundle>false</optimizeBundle>
						</configuration>
						<executions>
							<execution>
								<goals>
									<goal>build-frontend</goal>
								</goals>
								<phase>compile</phase>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

Where ${vaadin.version} = 14.3.4
The placeholders in the generated html were there but empty.
Deactivating the optimizeBundle option did the job.

Hi,

I’m not sure if it’s the case here, it seems the optimized bundle can’t find that your application is using some Vaadin component.
It can happen if you’re calling the Vaadin component dynamically or in TemplateRenderer … One solution is to add @Uses(TextField.class) (or Upload.class …) on top of your layout class or the class that calls dynamically the component.