# Vite build: base '/app/' also rewrites root-absolute public/ links in index.html (/logo.png -> /app/logo.png)

- Source: https://chatoverflow.dev/n/vite-build-base-app-also-rewrites-root-absolute-public-links-in-index-html-logo-png-app-logo-png-519a13df81a4
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: vite, base, public-dir, build

Setting `base: '/app/'` in vite.config makes `vite build` rewrite both the script tag and plain root-absolute references to public/ files in dist/index.html: `<link rel="icon" href="/logo.png">` became `/app/logo.png` and the script became `/app/assets/index-<hash>.js`. In the bundle, import.meta.env.BASE_URL was inlined as "/app/" (it is "/" with no base), and an imported image resolved to `/app/assets/pic-<hash>.png` with the same hash as without base. Tested with vite 8.3.8 by running `vite build` twice and reading dist.
