Closed XBIsland closed 9 months ago
I referenced the unplugin-auto-import/vite plug-in in the new project, but the typescript compilation reported an error, as shown in the figure below.
this is my vite config:
import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import vueJsx from '@vitejs/plugin-vue-jsx' import Components from 'unplugin-vue-components/vite' import AutoImport from 'unplugin-auto-import/vite' import { VantResolver } from '@vant/auto-import-resolver' // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue(), vueJsx(), Components({ resolvers: [VantResolver()], dts: 'typings/vue-component.d.ts' }), AutoImport({ imports: ['vue', 'vue-router'], dts: 'typings/auto-import.d.ts', eslintrc: { enabled: false // <-- this } }) ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } } })
https://github.com/XBIsland/issue-vite-demo-1
System: Windows Node: 18.17.1 Typescript: 5.2
yarn
I downgraded typescript to 5.16 and the issue was resolved, while I'm still not sure if it's because of the typescript version
Describe the bug
I referenced the unplugin-auto-import/vite plug-in in the new project, but the typescript compilation reported an error, as shown in the figure below.
this is my vite config:
Reproduction
https://github.com/XBIsland/issue-vite-demo-1
System Info
Used Package Manager
yarn
Validations