34 lines
845 B
TypeScript
34 lines
845 B
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
||
|
||
import vue from '@vitejs/plugin-vue'
|
||
import { defineConfig } from 'vite'
|
||
|
||
// https://vite.dev/config/
|
||
export default defineConfig({
|
||
plugins: [vue()],
|
||
server: {
|
||
proxy: {
|
||
// 开发期把 /api 转发到 vermis-maker 后端(8080),并去掉 /api 前缀
|
||
'/api': {
|
||
target: 'http://192.168.0.43:8080',
|
||
changeOrigin: true,
|
||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||
},
|
||
},
|
||
},
|
||
resolve: {
|
||
alias: {
|
||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||
},
|
||
},
|
||
css: {
|
||
preprocessorOptions: {
|
||
less: {
|
||
// 自动注入变量与混合宏,组件内可直接使用 @primary-color 等
|
||
additionalData:
|
||
'@import "@/styles/variables.less";\n@import "@/styles/mixins.less";',
|
||
},
|
||
},
|
||
},
|
||
})
|