-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
66 lines (61 loc) · 1.49 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
58
59
60
61
62
63
64
65
66
import { defineConfig } from "vite";
import Uni from "@dcloudio/vite-plugin-uni";
import AutoImport from 'unplugin-auto-import/vite'
import Modules from 'vite-plugin-use-modules'
import Components from 'unplugin-vue-components/vite'
import { VantResolver } from 'unplugin-vue-components/resolvers';
import UnoCSS from 'unocss/vite'
// https://vitejs.dev/config/
export default defineConfig({
build: {
minify: 'terser',
terserOptions: {
compress: {
// 生产环境时移除console
drop_console: true,
drop_debugger: true,
},
},
},
plugins: [
Uni({
vueOptions: {
reactivityTransform: true,
template: {
compilerOptions: {
isCustomElement: (tag) => tag.includes(' ')
}
}
}
}),
// https://github.com/antfu/unplugin-auto-import
AutoImport({
dts: 'runtime/auto-import.d.ts',
imports: [
'vue',
'vue/macros',
'@vueuse/core',
'pinia',
'uni-app'
],
dirs: [
'src/stores',
'src/utils',
],
vueTemplate: true
}),
// https://github.com/dishait/vite-plugin-use-modules
Modules({
target: 'src/plugins'
}),
// https://github.com/antfu/vite-plugin-components
Components({
dts: 'runtime/components.d.ts',
dirs: ['src/components'],
directoryAsNamespace: true,
resolvers: [VantResolver()],
}),
// https://github.com/unocss/unocss
UnoCSS(),
],
});