From b7618c4473396a752199d40960bfc7c121808e8b Mon Sep 17 00:00:00 2001
From: markthree <1801982702@qq.com>
Date: Wed, 2 Aug 2023 11:03:13 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20@=20=E8=B7=AF?=
=?UTF-8?q?=E5=BE=84=E5=88=AB=E5=90=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 6 +++---
presets/index.ts | 4 ++++
tsconfig.json | 3 ++-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 2e20d74..fcc8adc 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@
18. 插件自动加载支持
19. Vitest 单元测试支持
20. 支持 Markdown 渲染
-21. 路径别名 `~` 支持
+21. 路径别名支持
22. 命令行自动创建与删除
23. i18n 国际化支持
24. 漂亮的 404 页 支持
@@ -898,9 +898,9 @@ pnpm coverage
-### 21. 路径别名 `~` 支持
+### 21. 路径别名支持
-`~` 路径将被导向项目的 `src` 目录,同时有更好的类型提示
+`~` 或者 `@` 路径将被导向项目的 `src` 目录,同时有更好的类型提示
```html
diff --git a/presets/index.ts b/presets/index.ts
index abddc20..1078116 100644
--- a/presets/index.ts
+++ b/presets/index.ts
@@ -274,6 +274,10 @@ function Alias(): Plugin {
find: /^~/,
replacement: src,
},
+ {
+ find: /^@/,
+ replacement: src,
+ },
]
},
}
diff --git a/tsconfig.json b/tsconfig.json
index 60f8b0a..cefb769 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -14,7 +14,8 @@
"useDefineForClassFields": true,
"baseUrl": ".",
"paths": {
- "~/*": ["src/*"]
+ "~/*": ["src/*"],
+ "@/*": ["src/*"],
}
},
"include": [