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:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user