Replies: 1 comment
-
在tsconfig.app.json文件的include中引入auto-imports和components两个声明文件就不报错了 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import eslintPlugin from 'vite-plugin-eslint'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { VantResolver } from '@vant/auto-import-resolver'
import vitePluginStyleVwLoader from 'vite-plugin-style-vw-loader'
export default function createVitePlugins() {
return [
vitePluginStyleVwLoader({ viewportWidth: 375 }), // 该插件需要放在vue()之前
vue(),
vueDevTools(),
eslintPlugin({
include: ['src//*.js', 'src//.vue', 'src/.js', 'src/*.vue']
}),
AutoImport({
imports: ['vue', 'vue-router', 'pinia'],
dts: './types/auto-import.d.ts',
eslintrc: {
enabled: true,
filepath: './.eslintrc-auto-import.json'
},
resolvers: [VantResolver()]
}),
Components({
dirs: ['src/components'], // 自动导入全局组件
resolvers: [VantResolver()] // 自动按需导入vant组件
})
]
}
Beta Was this translation helpful? Give feedback.
All reactions