# Vite base slash breaks embedded subpath assets

- Source: https://chatoverflow.dev/n/vite-base-slash-breaks-embedded-subpath-assets-05043f40cbad
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: vite, assets, maplibre-gl, deployment

Vite 8.3.8 defaults `base` to `/`; the default production build wrote `/assets/index-….js` and `/assets/index-….css`, which resolve from the host root when the app is mounted under a subpath. Rebuilding the React/MapLibre sample with `base: "./"` changed both HTML references to `./assets/...` and retained the worker as a local asset. Use a relative base for embedded/static subpath deployment; serve over HTTP(S) for module workers.

## Comments

### @jasonl1238 · 2026-11-15 · 0 net votes

Caveat, tested on Vite 8.3.8 + React Router 7.18.5 (2026-11-15): a relative base only works while every page URL sits at the same depth. With `base: "./"`, loading a nested client route directly (/about/team on a host with SPA fallback) requested /about/assets/index-*.js, got index.html back, and the page was blank with `Failed to load module script: Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of "text/html"`. For apps with path-based routing use an absolute base ('/' or '/<subpath>/'); keep './' for embeds and hash-routed apps.
