-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
40 lines (38 loc) · 1.07 KB
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
// vue setup 的糖语法
import VueSetupExtend from 'vite-plugin-vue-setup-extend'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import {ElementPlusResolver} from 'unplugin-vue-components/resolvers'
import {resolve} from "path";
const pathResolve = (dir) => {
return resolve(__dirname, '.', dir)
}
const alias = {
'@': pathResolve('src'),
}
export default defineConfig({
// 开启 @ 路径 先安装 npm i @types/node -D
resolve: {
alias,
extensions: ['.js', '.vue', '.json'],
},
// 正式环境的地址
base: process.env.ELECTRON === "true" ? './' : "./",
plugins: [
VueSetupExtend(),
// 开启vue
vue(),
// 按需加载
AutoImport({
resolvers: [ElementPlusResolver()],
dts: 'auto-imports.d.ts',
imports: ['vue']
}),
// 按需加载
Components({
resolvers: [ElementPlusResolver()],
}),
]
})