2026-09-13 21:02:25 +03:30
|
|
|
import { fileURLToPath, URL } from 'node:url';
|
2026-09-09 06:46:27 +03:30
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
|
import vue from '@vitejs/plugin-vue';
|
|
|
|
|
|
2026-09-13 21:02:25 +03:30
|
|
|
// Ported from legacy henza_admin/vue.config.js.
|
|
|
|
|
// The legacy build switched publicPath/outputDir on NODE_ENV=='branch'; in Vite the
|
|
|
|
|
// equivalent switch is the --mode flag (`pnpm dev:branch` / `pnpm build:branch`),
|
|
|
|
|
// which src/utils/index.ts reads via import.meta.env.MODE.
|
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
|
|
|
const isBranch = mode === 'branch';
|
|
|
|
|
|
|
|
|
|
return {
|
2026-09-16 11:59:35 +03:30
|
|
|
// 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/' : '/',
|
2026-09-13 21:02:25 +03:30
|
|
|
plugins: [vue()],
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
|
|
|
},
|
2026-09-09 06:46:27 +03:30
|
|
|
},
|
2026-09-13 21:02:25 +03:30
|
|
|
css: {
|
|
|
|
|
preprocessorOptions: {
|
|
|
|
|
less: {
|
2026-09-14 15:05:05 +03:30
|
|
|
// ant-design-vue 4 dropped LESS theming (modifyVars) for CSS-in-JS design
|
|
|
|
|
// tokens; the equivalent primary/link/radius tokens now live in
|
|
|
|
|
// App.vue's <a-config-provider :theme>. This block only compiles the
|
|
|
|
|
// app's own farsi.less/utilities.less, which have no LESS variables.
|
2026-09-13 21:02:25 +03:30
|
|
|
javascriptEnabled: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
build: {
|
2026-09-14 17:30:04 +03:30
|
|
|
// Legacy's vue.config.js used outputDir 'dist/export' / 'branchDist/export',
|
|
|
|
|
// but this app's Dockerfile does `COPY dist /usr/share/nginx/html` and nginx
|
|
|
|
|
// serves that folder's ROOT. With the build landing in dist/export/, the
|
|
|
|
|
// root kept whatever index.html was committed there before — a stale
|
|
|
|
|
// pre-port build — so the deployed panel served that instead of this app.
|
|
|
|
|
// Build straight into the folder the image actually serves (which is also
|
|
|
|
|
// what apps/user-app does).
|
|
|
|
|
outDir: isBranch ? 'branchDist' : 'dist',
|
2026-09-13 21:02:25 +03:30
|
|
|
emptyOutDir: true,
|
|
|
|
|
sourcemap: false, // legacy: productionSourceMap: false
|
|
|
|
|
},
|
|
|
|
|
server: {
|
2026-09-16 01:15:16 +03:30
|
|
|
host: '0.0.0.0',
|
2026-09-13 21:02:25 +03:30
|
|
|
port: 5174,
|
|
|
|
|
proxy: {
|
|
|
|
|
'/api': 'http://localhost:3000',
|
2026-09-14 20:56:17 +03:30
|
|
|
// Uploaded files (ProductImage.url etc.) are served by the API's own
|
|
|
|
|
// static handler, not this dev server — without this they 404 in dev
|
|
|
|
|
// even though production nginx (nginx.conf) already proxies them.
|
|
|
|
|
'/uploads': 'http://localhost:3000',
|
2026-09-13 21:02:25 +03:30
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
2026-09-09 06:46:27 +03:30
|
|
|
});
|