-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
62 lines (60 loc) · 1.6 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
import uni from '@dcloudio/vite-plugin-uni'
import Components from '@uni-helper/vite-plugin-uni-components'
import { WotResolver } from '@uni-helper/vite-plugin-uni-components/resolvers'
import AutoImport from 'unplugin-auto-import/vite'
//import { nodeResolve } from '@rollup/plugin-node-resolve'
import { defineConfig } from 'vite'
// https://vitejs.dev/config/
export default async () => {
const UnoCss = (await import('unocss/vite')).default
return defineConfig({
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "./src/uni.scss";',
api: 'modern-compiler',
},
},
},
plugins: [
Components({
// 指定组件位置,默认是src/components
dirs: ['src/components'],
deep: true, // search for subdirectories
// ui库解析器
resolvers: [WotResolver()],
extensions: ['vue'],
// 配置文件生成位置
dts: 'src/types/import-components.d.ts'
}),
uni(),
//nodeResolve(),
AutoImport({
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.vue$/,
/\.vue\?vue/, // .vue
],
imports: [
'vue',
'uni-app',
'pinia',
{
'uni-mini-router': ['useRouter', 'useRoute'],
},
{
'alova/client': ['useRequest'],
},
],
dts: 'src/auto-imports.d.ts',
eslintrc: {
enabled: true,
filepath: './.eslintrc-auto-import.json',
},
}),
UnoCss(),
],
define: {
},
})
}