pierrejeambrun opened a new pull request, #67548: URL: https://github.com/apache/airflow/pull/67548
Vite emits both `<script src="./assets/...">` and `<link rel="modulepreload" href="./assets/...">` for chunks in the built `index.html`. The `transform-url-src` plugin in `vite.config.ts` only rewrites `src="./assets/"` to `src="./static/assets/"` — the modulepreload `href`s are left untouched. Behind the api-server's `/static/` mount those preload requests hit the SPA HTML fallback, and the browser fails them with: ``` Failed to load module script: Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of "text/html". ``` The chunks themselves still load via `<script src>` (whose path *is* rewritten), so the app keeps working. What's lost is the modulepreload optimization (those chunks aren't parallel-fetched ahead of import-graph discovery), plus each page load wastes three round-trips that return the full SPA HTML and floods the console. ### Fix Apply the same `static/` rewrite to `href="./assets/"` and switch all three rewrites to `replaceAll` so multiple matches (one per chunk) are handled — `replace` with a string only touches the first occurrence. Verified the rebuilt `dist/index.html` now points all `<link rel="modulepreload">` at `./static/assets/...`. > Note: this PR's branch is stacked on top of #67546 (the Monaco worker bundling fix); the modulepreload change is the second commit. Once #67546 merges, GitHub will collapse the diff to just the `vite.config.ts` change. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Opus 4.7) Generated-by: Claude Code (Opus 4.7) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
