Subfolder

Applicable from v6.1.0 and above.


Vite.js
.env
VITE_ASSETS_DIR=/sub

vite.config.ts
export default defineConfig({
  base: '/sub/',
  ...
});

src/main.tsx
<BrowserRouter basename="sub">
  ...
</BrowserRouter>

Next.js
.env
NEXT_PUBLIC_ASSETS_DIR=/sub

next.config.mjs
const nextConfig = {
  basePath: '/sub',
  ...
};