重写复现方法
This commit is contained in:
@@ -1,7 +1,44 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import Icons from 'unplugin-icons/vite' // 图标插件
|
||||
import IconsResolver from 'unplugin-icons/resolver' // 图标解析器
|
||||
import Components from 'unplugin-vue-components/vite' // 组件自动导入
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import { resolve, dirname } from 'node:path'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()]
|
||||
})
|
||||
export default ({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd())
|
||||
|
||||
const isProduction = mode === 'production'
|
||||
|
||||
return defineConfig({
|
||||
base: isProduction ? '/cApi/' : '/',
|
||||
plugins: [
|
||||
vue(),
|
||||
Components({
|
||||
resolvers: [
|
||||
// 自动解析图标组件(前缀为Icon,如<IconLogo />)
|
||||
IconsResolver({
|
||||
prefix: 'Icon',
|
||||
}),
|
||||
],
|
||||
}),
|
||||
Icons({
|
||||
autoInstall: true, // 自动安装图标依赖
|
||||
}),
|
||||
],
|
||||
server: {
|
||||
proxy: {
|
||||
[env.VITE_BASE_API]: {
|
||||
target: env.VITE_SERVER_URL,
|
||||
changeOrigin: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(dirname(fileURLToPath(import.meta.url)), 'src')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user