flow icon indicating copy to clipboard operation
flow copied to clipboard

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

Open mrgreywater opened this issue 1 year ago • 3 comments

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

mrgreywater avatar Oct 06 '22 10:10 mrgreywater

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

Artur- avatar Oct 06 '22 11:10 Artur-

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

mcollovati avatar Oct 06 '22 11:10 mcollovati

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

Artur- avatar Oct 06 '22 12:10 Artur-