feat: Use vant's own auto-import resolver

This commit is contained in:
CharleeWa 2024-08-26 17:08:51 +08:00
parent 0badda2afe
commit 2cb9ce6f95
3 changed files with 11 additions and 12 deletions

View File

@ -5,7 +5,7 @@ import legacy from '@vitejs/plugin-legacy'
import vue from '@vitejs/plugin-vue'
import UnoCSS from 'unocss/vite'
import AutoImport from 'unplugin-auto-import/vite'
import { VantResolver } from 'unplugin-vue-components/resolvers'
import { VantResolver } from '@vant/auto-import-resolver'
import Components from 'unplugin-vue-components/vite'
import { VueRouterAutoImports } from 'unplugin-vue-router'
import VueRouter from 'unplugin-vue-router/vite'
@ -64,6 +64,7 @@ export function createVitePlugins() {
dirs: [
'src/composables',
],
resolvers: [VantResolver()],
}),
// https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n

View File

@ -43,6 +43,7 @@
"@types/nprogress": "^0.2.3",
"@unocss/eslint-plugin": "0.62.2",
"@unocss/preset-rem-to-px": "0.62.2",
"@vant/auto-import-resolver": "^1.2.1",
"@vitejs/plugin-legacy": "^5.4.2",
"@vitejs/plugin-vue": "^5.1.2",
"autoprefixer": "^10.4.20",

View File

@ -81,6 +81,9 @@ importers:
'@unocss/preset-rem-to-px':
specifier: 0.62.2
version: 0.62.2
'@vant/auto-import-resolver':
specifier: ^1.2.1
version: 1.2.1
'@vitejs/plugin-legacy':
specifier: ^5.4.2
version: 5.4.2(terser@5.31.6)(vite@5.4.1(@types/node@22.4.0)(less@4.2.0)(terser@5.31.6))
@ -1701,6 +1704,9 @@ packages:
peerDependencies:
vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0
'@vant/auto-import-resolver@1.2.1':
resolution: {integrity: sha512-czGWW4UolNITkF3qQSQlpHDHAsI3/GHVKbRMmEEpry7NWdnU4p5a5jBi0VApbaLa5g80Hy10XVs3IB+UozoSUw==}
'@vant/popperjs@1.3.0':
resolution: {integrity: sha512-hB+czUG+aHtjhaEmCJDuXOep0YTZjdlRR+4MSmIFnkCQIxJaXLQdSsR90XWvAI2yvKUI7TCGqR8pQg2RtvkMHw==}
@ -4194,10 +4200,6 @@ packages:
resolution: {integrity: sha512-bEqQxeC7rxtxPZ3M5V4Djcc4lQqKPgGe3mAWZvxcSmX5jhGxll19NliaRzQSQPrk4xJZSGniK3puLWpRuZN7VQ==}
engines: {node: '>=14.0.0'}
unplugin@1.12.0:
resolution: {integrity: sha512-KeczzHl2sATPQUx1gzo+EnUkmN4VmGBYRRVOZSGvGITE9rGHRDGqft6ONceP3vgXcyJ2XjX5axG5jMWUwNCYLw==}
engines: {node: '>=14.0.0'}
upath@1.2.0:
resolution: {integrity: sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==}
engines: {node: '>=4'}
@ -6269,6 +6271,8 @@ snapshots:
- rollup
- supports-color
'@vant/auto-import-resolver@1.2.1': {}
'@vant/popperjs@1.3.0': {}
'@vant/touch-emulator@1.4.0': {}
@ -9029,13 +9033,6 @@ snapshots:
webpack-sources: 3.2.3
webpack-virtual-modules: 0.6.2
unplugin@1.12.0:
dependencies:
acorn: 8.12.1
chokidar: 3.6.0
webpack-sources: 3.2.3
webpack-virtual-modules: 0.6.2
upath@1.2.0: {}
update-browserslist-db@1.1.0(browserslist@4.23.3):