fix: prevent deletion of dev-server generated files by cleanup task#24677
Closed
sissbruecker wants to merge 1 commit into
Closed
fix: prevent deletion of dev-server generated files by cleanup task#24677sissbruecker wants to merge 1 commit into
sissbruecker wants to merge 1 commit into
Conversation
TaskRemoveOldFrontendGeneratedFiles deletes files in the frontend generated folder that are not recognized as known generated files. Files generated only by the dev server with hot deploy (index.tsx, vaadin-react.tsx, layouts.json, flow/ReactAdapter.tsx, vite-devmode.ts) are not tracked when a standalone prepare-frontend runs without the index and React generation tasks, so they get deleted. The running app still references these files, which breaks the page: missing vite-devmode.ts triggers an infinite reload loop through its onerror reload handler, and missing index.tsx/vaadin-react.tsx break the vaadin.ts import graph and show a Vite error. Add these files to the known files list, extending the earlier fix for app-shell-imports. Related to #24108 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sissbruecker
commented
Jun 18, 2026
Contributor
Author
There was a problem hiding this comment.
Overall it feels like the exclusion approach is not very solid, so maybe we should look for a more appropriate fix.
If it helps, the issue can be reproduced in flow-components:
- Start a Jetty server in hot deploy mode
mvn package jetty:run -Dvaadin.pnpm.enable -Dvaadin.frontend.hotdeploy=true -am -B -q -DskipTests -pl vaadin-button-flow-parent/vaadin-button-flow-integration-tests - Run the frontend prepare goal:
mvn flow:prepare-frontend -pl vaadin-button-flow-parent/vaadin-button-flow-integration-tests - Open the app in the browser, observe that the page reloads infinitely
|
Member
|
#24679 would be an alternative approach for this that wouldn't require listing all files |
Contributor
Author
|
That looks like a saner approach so let's go with that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
When starting an app with
vaadin.frontend.hotdeployenabled, and then runningmvn compileafterwards, it deletes frontend files that are required for the app to function. The worst offender is deletingvite-devmode.ts, which, due to a JS listener that Vite injects into the HTML, causes the app to reload infinitely, as the file can never be loaded.The files are removed because
compilealso runsflow:prepare-frontend, which attempts to remove unused frontend files. It does make some exceptions, however it doesn't consider files that are required for hot deploy mode specifically.This change adds some more exclusions that I had to add to get the frontend working again: vite-devmode.ts, index.tsx, vaadin-react.tsx, layouts.json, ReactAdapter.tsx
Related to #24108
Type of change