Skip to content

feat: generate default index.html into frontend/generated/#24469

Draft
Artur- wants to merge 2 commits into
mainfrom
index-html-hidden
Draft

feat: generate default index.html into frontend/generated/#24469
Artur- wants to merge 2 commits into
mainfrom
index-html-hidden

Conversation

@Artur-
Copy link
Copy Markdown
Member

@Artur- Artur- commented May 29, 2026

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.

Artur- added 2 commits May 29, 2026 10:34
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant