-
Notifications
You must be signed in to change notification settings - Fork 69
/
vite.config.ts
57 lines (54 loc) · 1.44 KB
/
vite.config.ts
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import type { UserConfig, ConfigEnv } from 'vite';
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from "path";
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
//https://github.com/element-plus/unplugin-element-plus/blob/HEAD/README.zh-CN.md
import ElementPlus from 'unplugin-element-plus/vite'
export default defineConfig(({ command, mode }: ConfigEnv): UserConfig => {
// const env = loadEnv(mode, process.cwd(), '')
console.log(command, mode);
return {
plugins: [vue(),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),
ElementPlus({
// useSource: true
})
],
publicDir: "public",
base: "./",
server: {
host: '0.0.0.0',
port: 8112,
open: false,
strictPort: false,
// proxy: {}
},
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
"components": resolve(__dirname, "./src/components"),
"api": resolve(__dirname, "./src/api"),
},
},
css: {
// css预处理器
preprocessorOptions: {
scss: {
// charset: false,
additionalData: `@use "./src/assets/css/variable.scss" as *;`,
},
},
},
build: {
outDir: 'dist',
},
}
})