2025-07-10 11:24:06 +08:00
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
2025-07-14 17:14:32 +08:00
|
|
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
|
|
|
import { viteMockServe } from 'vite-plugin-mock'
|
|
|
|
import path from 'path'
|
2025-07-10 11:24:06 +08:00
|
|
|
|
2025-07-14 17:14:32 +08:00
|
|
|
export default defineConfig(({ command }) => {
|
|
|
|
return {
|
|
|
|
plugins: [
|
|
|
|
vue(),
|
|
|
|
createSvgIconsPlugin({
|
|
|
|
iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
|
|
|
|
symbolId: 'icon-[dir]-[name]',
|
|
|
|
}),
|
|
|
|
viteMockServe({
|
|
|
|
enable: command === 'serve', // 仅在开发环境启用
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'@': path.resolve(__dirname, './src'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//SCSS全部变量配置
|
|
|
|
css: {
|
|
|
|
preprocessorOptions: {
|
|
|
|
scss: {
|
|
|
|
additionalData: `@use "@/styles/variable.scss" as *;`, // 推荐使用 @use
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2025-07-10 11:24:06 +08:00
|
|
|
})
|