|
@@ -2,7 +2,7 @@
|
|
|
* @Author: wjc
|
|
|
* @Date: 2024-05-27 10:17:11
|
|
|
* @LastEditors: wjc
|
|
|
- * @LastEditTime: 2024-06-06 09:42:32
|
|
|
+ * @LastEditTime: 2024-06-18 10:53:13
|
|
|
* @Description:
|
|
|
*/
|
|
|
import path from 'node:path'
|
|
@@ -12,6 +12,7 @@ import uni from '@dcloudio/vite-plugin-uni'
|
|
|
import PurgeIcons from 'vite-plugin-purge-icons'
|
|
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
|
+import Components from 'unplugin-vue-components/vite'
|
|
|
|
|
|
const root = process.cwd()
|
|
|
|
|
@@ -45,6 +46,11 @@ export default defineConfig(({ mode }) => {
|
|
|
symbolId: 'icon-[dir]-[name]',
|
|
|
svgoOptions: true,
|
|
|
}),
|
|
|
+ Components({
|
|
|
+ // 按需导入组件,相关组件声明放置于 components.d.ts
|
|
|
+ dts: './types/components.d.ts',
|
|
|
+ dirs: ['src/components'],
|
|
|
+ }),
|
|
|
AutoImport({
|
|
|
include: [
|
|
|
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
|
|
@@ -52,7 +58,7 @@ export default defineConfig(({ mode }) => {
|
|
|
/\.vue\?vue/, // .vue
|
|
|
],
|
|
|
dirs: ['./src'],
|
|
|
- imports: ['vue', 'uni-app'], // 限定范围为 vue, vue-router
|
|
|
+ imports: ['vue', 'uni-app'], // 限定范围为 vue, uni-app
|
|
|
dts: 'types/auto-import.d.ts', // 自动生成 'auto-import.d.ts'全局声明
|
|
|
}),
|
|
|
PurgeIcons(),
|