feat: generate default index.html into frontend/generated/#24469
Draft
Artur- wants to merge 2 commits into
Draft
feat: generate default index.html into frontend/generated/#24469Artur- wants to merge 2 commits into
Artur- wants to merge 2 commits into
Conversation
Hide the Vaadin-generated index.html from source control by writing it into the frontend generated/ folder instead of frontend/. A user-provided frontend/index.html still overrides the default. TaskUpdateSettingsFile exposes the resolved path as clientIndexHtmlSource so vite.generated.ts picks up whichever file actually exists. At runtime, FrontendUtils falls back to frontend/generated/ when serving via vite (which returns 404 for files outside its root) or when reading directly from disk in dev-bundle mode.
Vite's HTML inputs preserve their relative path from the project root, so an index.html generated into frontend/generated/ was emitted as target/.../webapp/generated/index.html. The stats plugin and the Java-side consumers expect it at target/.../webapp/index.html, which broke the dev-bundle build. transformIndexHtml's '/index.html' check also skipped script injection in that case. Compute the source's relative path from the vite root, use it in the transformIndexHtml check, and rename the bundled asset back to index.html in generateBundle.
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.
Hide the Vaadin-generated index.html from source control by writing it into the frontend generated/ folder instead of frontend/. A user-provided frontend/index.html still overrides the default.
TaskUpdateSettingsFile exposes the resolved path as clientIndexHtmlSource so vite.generated.ts picks up whichever file actually exists. At runtime, FrontendUtils falls back to frontend/generated/ when serving via vite (which returns 404 for files outside its root) or when reading directly from disk in dev-bundle mode.