From 5b8628cd39dc6e600dc5bbc27492571e79a501d1 Mon Sep 17 00:00:00 2001 From: ayangweb <75017711+ayangweb@users.noreply.github.com> Date: Tue, 1 Apr 2025 09:29:01 +0800 Subject: [PATCH] chore: support for path aliases (#25) --- tsconfig.json | 6 ++++++ vite.config.ts | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 0f0a605..e25c3b1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,10 +4,15 @@ "jsx": "preserve", "lib": ["ES2020", "DOM", "DOM.Iterable"], "useDefineForClassFields": true, + + "baseUrl": ".", "module": "ESNext", /* Bundler mode */ "moduleResolution": "bundler", + "paths": { + "@/*": ["src/*"] + }, "resolveJsonModule": true, "allowImportingTsExtensions": true, @@ -19,6 +24,7 @@ "noEmit": true, "isolatedModules": true, "skipLibCheck": true + }, "references": [{ "path": "./tsconfig.node.json" }], "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"] diff --git a/vite.config.ts b/vite.config.ts index 39d7ecc..952b842 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,3 +1,4 @@ +import { resolve } from 'node:path' import { env } from 'node:process' import vue from '@vitejs/plugin-vue' @@ -11,7 +12,7 @@ export default defineConfig(async () => ({ plugins: [vue(), UnoCSS()], resolve: { alias: { - '@': '/src', + '@': resolve(__dirname, 'src'), }, }, // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`