37 lines
924 B
JavaScript
37 lines
924 B
JavaScript
import { defineConfig, loadEnv } from 'vite'
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
import process from 'node:process'
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
// 按需导入 Element-plus 模块
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
import Components from 'unplugin-vue-components/vite'
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(({ mode }) => {
|
|
console.log(mode)
|
|
return {
|
|
server: {
|
|
port: 3002,
|
|
proxy: {}
|
|
},
|
|
base: loadEnv(mode, process.cwd()).VITE_BASE_URL,
|
|
plugins: [
|
|
vue(),
|
|
// Element-plus 按需导入模块
|
|
AutoImport({
|
|
resolvers: [ElementPlusResolver()]
|
|
}),
|
|
Components({
|
|
resolvers: [ElementPlusResolver()]
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
}
|
|
}
|
|
}
|
|
})
|