Files
pqs-9100_client/frontend/vite.config.ts
2024-08-19 14:01:14 +08:00

63 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {defineConfig, loadEnv} from 'vite'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import vue from '@vitejs/plugin-vue'
import path from 'path'
export default defineConfig((config) => {
return {
plugins: [
vue(),
// svg图标配置可以使用svg图标
createSvgIconsPlugin({
iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
symbolId: 'icon-[dir]-[name]',
}),
],
// 基础配置
base: './',
publicDir: 'public',
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
css: {
preprocessorOptions: {
less: {
modifyVars: {
'@border-color-base': '#dce3e8',
},
javascriptEnabled: true,
},
},
},
build: {
outDir: 'dist',
assetsDir: 'assets',
assetsInlineLimit: 4096,
cssCodeSplit: true,
sourcemap: false,
minify: 'terser',
terserOptions: {
compress: {
// 生产环境去除console及debug
drop_console: false,
drop_debugger: true,
},
},
},
server: {
host: '0.0.0.0',
open: false,
proxy: {
'/api': {
target: 'http://192.168.1.125:18092', //hsw
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, '') //路径重写,把'/api'替换为''
}
}
},
}
})