-
Notifications
You must be signed in to change notification settings - Fork 491
Closed
Description
使用TypeScript时似乎缺少 “@types/node” 依赖
路径别名配置似乎也有问题
> html:src/App.vue:5:7: error: Could not resolve "@/components/HelloWorld.vue" (the plugin "vite:dep-scan" didn't set a resolve directory)
5 │ import '@/components/HelloWorld.vue'
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> html:/src/views/HomeView.vue:5:7: error: Could not resolve "@/components/TheWelcome.vue" (the plugin "vite:dep-scan" didn't set a resolve directory)
5 │ import '@/components/TheWelcome.vue'
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// import { fileURLToPath } from 'url'
import { resolve } from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), vueJsx()],
resolve: {
alias: {
// '@/': fileURLToPath(new URL('./src/', import.meta.url))
'@': resolve(__dirname, 'src')
}
}
})
mengshulu
Metadata
Metadata
Assignees
Labels
No labels