40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
||
|
||
import { defineConfig } from 'vite'
|
||
import vue from '@vitejs/plugin-vue'
|
||
import vueDevTools from 'vite-plugin-vue-devtools'
|
||
import { viteSingleFile } from 'vite-plugin-singlefile'
|
||
import AutoImport from 'unplugin-auto-import/vite'
|
||
import Components from 'unplugin-vue-components/vite'
|
||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||
import svgLoader from 'vite-svg-loader'
|
||
|
||
// https://vite.dev/config/
|
||
export default defineConfig({
|
||
plugins: [
|
||
vue(),
|
||
vueDevTools(),
|
||
// 加载 SVG 文件为 Vue 组件
|
||
svgLoader(),
|
||
// 打包为单文件
|
||
viteSingleFile(),
|
||
// 自动导入 Element Plus 相关函数,如:ElMessage, ElNotification 等
|
||
AutoImport({
|
||
resolvers: [ElementPlusResolver()],
|
||
}),
|
||
// 自动导入 Element Plus 组件
|
||
Components({
|
||
resolvers: [ElementPlusResolver()],
|
||
}),
|
||
],
|
||
resolve: {
|
||
alias: {
|
||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||
},
|
||
},
|
||
build: {
|
||
// 输出目录
|
||
outDir: 'hook/dist',
|
||
},
|
||
})
|