diff --git a/package.json b/package.json index 44aafc1..65df2f1 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ }, "dependencies": { "@element-plus/icons-vue": "^2.3.1", + "@types/node": "^22.10.0", "element-plus": "^2.8.8", "vue": "^3.5.13", "vue-router": "^4.5.0" diff --git a/src/router/index.ts b/src/router/index.ts index 26d2878..091a872 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -4,12 +4,12 @@ const routes: RouteRecordRaw[] = [ { path: '/login', name: 'Login', - component: ()=>import('../views/login/index.vue') + component: ()=>import('@/views/login/index.vue') }, { path: '/:pathMatch(.*)*', name: '404', - component: ()=>import('../views/error/404.vue') + component: ()=>import('@/views/error/404.vue') }, ] const router: Router = createRouter({ diff --git a/tsconfig.app.json b/tsconfig.app.json index 656801f..6f8cff3 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -21,7 +21,11 @@ "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, "noUncheckedSideEffectImports": true, - "types": ["element-plus/global"] + "types": ["element-plus/global"], + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } }, "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"] } diff --git a/tsconfig.node.json b/tsconfig.node.json index d6c3ec5..2c6daf5 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -19,7 +19,11 @@ "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, "noUncheckedSideEffectImports": true, - "types": ["element-plus/global"] + "types": ["element-plus/global"], + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } }, "include": ["vite.config.ts"] } diff --git a/vite.config.ts b/vite.config.ts index bbcf80c..6ef2069 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,13 @@ import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' +import { resolve } from 'path' // https://vite.dev/config/ export default defineConfig({ plugins: [vue()], + resolve: { + alias: { + '@': resolve(__dirname, 'src') + } + } })