vaadin / flow

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

No error for top-level async with hotdeploy=true #20012

Open Legioth opened 1 month ago

Legioth commented 1 month ago

Description of the bug

In an application that uses a top-level await, errors are shown only when a bundle is being built (production build or app bundle when using hotdeploy=false) but not when running through Vite's dev mode (hotdeploy=true). This may lead to surprises in a late stage of development.

Expected behavior

Expected that Vite complains about top-level async also in dev mode with hotdeploy=true.

Minimal reproducible example

  1. Get a Hilla app from start.vaadin.com
  2. Launch once to generate frontend files
  3. Copy frontend/generated/index.tsx into frontend´ and add a top-levelawait`
  4. Notice that there are no errors
  5. Create a production build
  6. Notice errors

Versions

mshabarov commented 1 month ago

As this may be a pity surprise when preparing a ready application for production, I raised the severity.