import { defineConfig } from 'vite'
import { resolve } from 'path'
import vue from '@vitejs/plugin-vue'
import { viteMockServe } from 'vite-plugin-mock'
import viteSvgIcons from 'vite-plugin-svg-icons'
export default defineConfig(({ command }) => {
const prodMock = true
return {
base: '/',
plugins: [
vue(),
viteMockServe({
supportTs: false,
mockPath: 'mock',
localEnabled: command === 'serve',
prodEnabled: command !== 'serve' && prodMock,
injectCode: `
import { setupProdMockServer } from './mockProdServer';
setupProdMockServer();
`
}),
viteSvgIcons({
iconDirs: [resolve(process.cwd(), 'src/icons')],
symbolId: 'icon-[dir]-[name]'
})
],
resolve: {
alias: {
'@': resolve('./src'),
'@img': resolve('./src/assets/img')
}
},
build: {
terserOptions: {
compress: {
drop_console: command !== 'serve',
drop_debugger: command !== 'serve'
}
}
},
server: {
host: '0.0.0.0',
port: 7001,
open: false,
proxy: {
'/api': 'http://10.10.10.90:8224'
}
}
}
})