尚硅谷--管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.0 KiB

2 months ago
//配置代理跨域等
2 months ago
// vite.config.ts
2 months ago
import { defineConfig } from 'vite'
2 months ago
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
2 months ago
import { viteMockServe } from 'vite-plugin-mock'
2 months ago
import vue from '@vitejs/plugin-vue'
2 months ago
import path from 'path'
2 months ago
export default defineConfig(({ command }) => {
return {
plugins: [
vue(),
createSvgIconsPlugin({
// Specify the icon folder to be cached
iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
// Specify symbolId format
symbolId: 'icon-[dir]-[name]',
}),
viteMockServe({
enable: command === 'serve', //保证开发阶段可以使用mock接口
}),
],
2 months ago
2 months ago
resolve: {
alias: {
'@': path.resolve('./src'), // 相对路径别名配置,使用 @ 代替 src
},
2 months ago
},
2 months ago
2 months ago
//scss全局变量的配置
css: {
preprocessorOptions: {
scss: {
javascriptEnabled: true,
additionalData: '@import "./src/styles/variable.scss";',
},
2 months ago
},
},
2 months ago
}
})