原因 Internal server error: Failed to resolve import’@/‘’ Does the file exist?
1 2 3 4 5 6 7 8 9
Are they installed? Failed to resolve import "@/views/Home.vue" from "src/router/index.ts". Does the file exist? 上午8:48:58 [vite] Internal server error: Failed to resolve import "@/views/Home.vue" from "src/router/index.ts". Does the file exist? Plugin: vite:import-analysis File: /Users/larahuang/Desktop/作品集/員工打卡系統/CheckInSystem/src/router/index.ts:7:36 4 | path: "/", 5 | name: "Home", 6 | component: () => import("@/views/Home.vue") | ^
#修改vite.config.ts配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { fileURLToPath, URL } from 'node:url';//加入 import { resolve } from 'path';//加入
<script setup lang="ts"> import type { ElForm } from 'element-plus' type FormInstance =InstanceType<typeof ElForm> type FormRules =InstanceType<typeof ElForm>