fix(admin): serve assets under /admin base for shared-domain deploy

Dokploy Path /admin on the customer app host needs Vite base /admin/ so index.html loads /admin/assets instead of user-app root.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
s.esmaeili
2026-10-31 22:53:10 +03:30
co-authored by Cursor
parent 22c7e31438
commit 09c17a9045
153 changed files with 149 additions and 140 deletions
+12 -6
View File
@@ -19,12 +19,18 @@ export default defineConfig(({ mode }) => {
return {
envDir: fileURLToPath(new URL('../..', import.meta.url)),
// Admin is served on its own subdomain (e.g. adm.bnk…), so assets must be
// rooted at `/`. Legacy used publicPath `admin/` because it shared a host
// path; keeping that here made index.html request `/admin/assets/…` while
// the image only has `/assets/…` → white screen 404.
// Branch mode still mounts under `/branch/` when that mode is used.
base: isBranch ? '/branch/' : '/',
// Shared-host deploy (Dokploy Path `/admin` on the same domain as user-app):
// assets and the Vue router must be rooted under `/admin/`. A bare `/` base
// makes index.html request `/assets/…`, which hits user-app and 404s while
// the real files live at `/admin/assets/…`.
// Override with ADMIN_PANEL_BASE=/ when admin has its own subdomain.
// Branch mode still mounts under `/branch/`.
base: isBranch
? '/branch/'
: (() => {
const raw = rootEnv.ADMIN_PANEL_BASE || '/admin/';
return raw.endsWith('/') ? raw : `${raw}/`;
})(),
// Build number + «what changed» notes → version.json (scripts/app-version.mjs).
plugins: [
vue(),