Files
tehran_tala/apps/admin-panel/vite.config.ts
T
s.esmaeiliandClaude Sonnet 5 7e30701570 admin-panel: upgrade to ant-design-vue 4.2.6
- Bump ant-design-vue 3.2.20 -> 4.2.6, @ant-design/icons-vue 6.1.0 -> 7.0.1.
- ADV4 removed LESS theming (modifyVars) for CSS-in-JS design tokens: drop
  the vite.config.ts modifyVars block and the antd.less import; move the
  three tokens ant actually consumed (primary/link/border-radius) to
  App.vue's <a-config-provider :theme>.
- Delete src/assets/styles/ant.less (426 lines of hand-written RTL flips):
  ADV4 renders RTL natively via CSS logical properties given direction="rtl",
  which App.vue already sets. Preserve only the small residue ADV4 doesn't
  cover natively (upload filename LTR, select dropdown z-index, tabs nav
  direction) in a new rtl-overrides.css.
- Clean up the stale --primary/--accent token comment in utilities.less now
  that ant.less is gone.
- Verified: pnpm build (vue-tsc -b && vite build) passes with zero errors;
  the codebase already used v-model:open everywhere (no ADV3 visible prop
  usage to migrate).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-14 15:05:05 +03:30

46 lines
1.5 KiB
TypeScript

import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
// 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)),
},
},
css: {
preprocessorOptions: {
less: {
// 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.
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',
},
},
};
});