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 {
|
|
|
|
|
// legacy: publicPath: isBranch ? '/branch/' : 'admin/'
|
|
|
|
|
base: isBranch ? '/branch/' : '/admin/',
|
|
|
|
|
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: {
|
|
|
|
|
// legacy: outputDir: isBranch ? 'branchDist/export' : 'dist/export'
|
|
|
|
|
outDir: isBranch ? 'branchDist/export' : 'dist/export',
|
|
|
|
|
emptyOutDir: true,
|
|
|
|
|
sourcemap: false, // legacy: productionSourceMap: false
|
|
|
|
|
},
|
|
|
|
|
server: {
|
|
|
|
|
port: 5174,
|
|
|
|
|
proxy: {
|
|
|
|
|
'/api': 'http://localhost:3000',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
2026-09-09 06:46:27 +03:30
|
|
|
});
|