43 lines
890 B
TypeScript
43 lines
890 B
TypeScript
// 剧游AI管理后台 Vite 构建配置,配置 Vue 插件、路径别名、代理与输出目录
|
|
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { findAvailablePort } from '../vite-port'
|
|
|
|
const devHost = '127.0.0.1'
|
|
const devPort = await findAvailablePort(devHost, 5500)
|
|
|
|
export default defineConfig({
|
|
base: '/admin/',
|
|
plugins: [vue()],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
},
|
|
},
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {
|
|
api: 'modern-compiler',
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
outDir: '../API/static/admin',
|
|
emptyOutDir: true,
|
|
},
|
|
server: {
|
|
host: devHost,
|
|
port: devPort,
|
|
open: false,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8123',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
})
|