feat(admin): set /admin base path for reverse proxy deployment

Configure Vite base, Vue Router history, axios baseURL and container
Nginx to serve the admin panel under /admin/ path prefix.

🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
2026-06-09 09:18:16 +08:00
parent 5279a7f831
commit b1ef7dc6f9
5 changed files with 25 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';
export default defineConfig({
base: '/admin/',
plugins: [vue()],
resolve: {
// 避免 src 内遗留的 .js 抢先于 .ts/.vue 被解析(曾导致 i18n 文案缺失)
@@ -15,6 +16,12 @@ export default defineConfig({
publicDir: resolve(__dirname, '../../packages/shared/public'),
server: {
port: 5174,
proxy: { '/api': { target: 'http://localhost:3000', changeOrigin: true } },
proxy: {
'/admin/api': {
target: 'http://localhost:3000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/admin\/api/, '/api'),
},
},
},
});