Skip to content

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

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

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

Conversation

@Artur-

@Artur- Artur- commented May 29, 2026

Copy link
Copy Markdown
Member

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 3 commits June 12, 2026 14:51
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.
The previous attempt used `generateBundle` to rename the HTML asset,
but rolldown emits HTML files outside the bundle object (they only
exist on disk), so the rename never fired and the stats plugin still
crashed reading target/.../webapp/index.html.

Switch to `writeBundle`, which runs after the HTML has been emitted to
disk and before the stats plugin's `enforce: 'post'` writeBundle hook.
Also strip the leading `../` from src/href URLs that rolldown added to
climb out of generated/, since after the move the HTML lives at the
build output root.
@Artur- Artur- force-pushed the index-html-hidden branch from b1e5fa1 to d152c64 Compare June 12, 2026 11:51
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Test Results

 1 425 files   - 22   1 425 suites   - 22   1h 7m 31s ⏱️ - 18m 3s
10 218 tests + 1   9 951 ✅  - 198  68 💤 ±0  34 ❌ +34  165 🔥 +165 
10 632 runs   - 57  10 341 ✅  - 279  69 💤 ±0  38 ❌ +38  184 🔥 +184 

For more details on these failures and errors, see this check.

Results for commit d152c64. ± Comparison against base commit f5a0ba9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant