feat: complete admin panel and backend admin api migration
This commit is contained in:
@@ -1,12 +1,49 @@
|
||||
import { fileURLToPath, URL } from 'node:url';
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/api': 'http://localhost:3000',
|
||||
// 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: {
|
||||
// Verbatim from legacy vue.config.js configureWebpack less-loader modifyVars.
|
||||
modifyVars: {
|
||||
'primary-color': '#1c2d56',
|
||||
'secondary-color': '#836447',
|
||||
'third-color': '#f5cb55',
|
||||
'link-color': '#1DA57A',
|
||||
'border-radius-base': '6px',
|
||||
},
|
||||
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',
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user