Summary
The device config plugin derives the Vite base from the output folder name, so a
build emits index.html with absolute asset URLs like /common/assets/.... When you
serve the generated dist/<device>/ directory as the web root (the natural thing to do,
and how a packaged TV app loads), those /common/assets/... paths don't exist at that
root — the assets are actually at /assets/... — so every script/asset 404s and the app
fails to load.
Environment
- Starter template (default config)
- Vite 6.x,
@vitejs/plugin-legacy
- Reproduced with no
TARGET_DEVICE set (defaults to common) and with TARGET_DEVICE=tizen
Steps to reproduce
npm install
npm run build
- Serve the build as its own root, e.g.
cd dist/common && npx serve .
(or sideload dist/tizen on a device, where the app loads from a file://-style root)
- Open the app.
Expected
The contents of dist/<device>/ are self-contained and load correctly when that folder
is the web root.
Actual
dist/<device>/index.html references assets with an absolute, folder-prefixed path:
<script type="module" crossorigin src="/common/assets/index-XXXX.js"></script>
Summary
The device config plugin derives the Vite
basefrom the output folder name, so abuild emits
index.htmlwith absolute asset URLs like/common/assets/.... When youserve the generated
dist/<device>/directory as the web root (the natural thing to do,and how a packaged TV app loads), those
/common/assets/...paths don't exist at thatroot — the assets are actually at
/assets/...— so every script/asset 404s and the appfails to load.
Environment
@vitejs/plugin-legacyTARGET_DEVICEset (defaults tocommon) and withTARGET_DEVICE=tizenSteps to reproduce
npm installnpm run buildcd dist/common && npx serve .(or sideload
dist/tizenon a device, where the app loads from afile://-style root)Expected
The contents of
dist/<device>/are self-contained and load correctly when that folderis the web root.
Actual
dist/<device>/index.htmlreferences assets with an absolute, folder-prefixed path: