Answer the question
In order to leave comments, you need to log in
How to "configure loader for .vue files" in Vite?
Moved the project from Vue to Vite (both on TS), and after running in cmd "vite", gives similar errors:
error: No loader is configured for ".vue" files: src/views/Auth/Login.vue
Type Support For .vue Imports in TS
Answer the question
In order to leave comments, you need to log in
In general, the fact is that Vite does not like imports with @. For example, if you change the import from "@/components/header/header.vue" to "/src/components/header/header.vue", then there will be no error.
upd: in order for @ to work, you need to do this:
tsconfig.json (compilerOptions)
"baseUrl": ".",
"paths": {
"@/*": [
"src/*"
]
npm i @types/node -D
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import * as path from "path"
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: [
{ find: '@', replacement: path.resolve(__dirname, 'src') },
],
},
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question