vaadin / flow

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

23.2+ Production build with Vite shows blank screen (Dev mode works) #14746

Open mrgreywater opened 1 year ago

mrgreywater commented 1 year ago

Description of the bug

When running the project in Dev mode everything works fine, production build only shows a blank screen. Furthermore there is no indication what the issue is. Creating the repro case was therefore difficult.

Minimal reproducible example

Use the 23.2.2 starter project and add the following code.

Camera.java

@Tag("photo-camera")
@JsModule("./typescript/camera.ts")
@NpmPackage(value = "isomorphic-fetch", version = "3.0.0")
@NpmPackage(value = "fetch-retry", version = "5.0.2")
public class Camera extends LitTemplate {
}

camera.ts

// @ts-ignore
import * as originalFetch from 'isomorphic-fetch';
import f from 'fetch-retry';
const fetch = f(originalFetch);

Create the production build like so: mvn clean vaadin:clean-frontend package -DskipTests -Pproduction

Expected behavior

When Dev mode works, so should the production build. If there is an issue, display that error on the page or in the command line.

Actual behavior

No error is shown, page stays blank (except the default vaadin loading bar at the top)

Versions:

- Vaadin / Flow version: 23.2.2
- Java version: 17
- OS version: Win11
- Development or production mode: production
- Project from start.vaadin.com or activated in application: starter
Artur- commented 1 year ago

Can't reproduce. Prod mode works the same as dev mode when running with. java -jar target/app.jar. In Chrome on a Mac

mcollovati commented 1 year ago

I could reproduce it with 23.2.3 and got this error on JavaScript console

image

If I change originalFetch import to import originalFetch from 'isomorphic-fetch'; I can't see any error and the page is shown correctly

Chrome 106 on Linux

Artur- commented 1 year ago

Is this something that should be reported to Vite then if dev mode and build mode works differently?