From 7c08be3e40ee8bdf6179fe49a44980ef205246e1 Mon Sep 17 00:00:00 2001
From: markthree <1801982702@qq.com>
Date: Fri, 1 Dec 2023 15:15:38 +0800
Subject: [PATCH] =?UTF-8?q?docs(README):=20=E6=B7=BB=E5=8A=A0=20base=20?=
=?UTF-8?q?=E5=AE=89=E5=85=A8=E7=9A=84=E8=B7=AF=E5=BE=84=E8=A7=A3=E6=9E=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 19 +++++++++++++++++++
src/composables/path.ts | 1 -
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 2a35ce9..db63a1a 100644
--- a/README.md
+++ b/README.md
@@ -52,6 +52,7 @@
35. `renovate` 自动更新依赖
36. 自动版本更新并生成 `CHANGELOG`
37. 最快最小的 `dockerfile` 静态 `go` 服务
+38. `base` 安全的路径解析
@@ -1232,6 +1233,24 @@ pnpm deps:fresh
具体可见 👉 [PierreZ/goStatic](https://github.com/PierreZ/goStatic)
+
+
+
+38. base 安全的路径解析
+
+在 `vite` 中,如果我们改了 `vite.config.ts` 中的 `base`,这导致资源路径和路由路径失效,使用 `safeResolve` 可以保证在开发环境和生产环境下都是统一的 `base`.
+
+```html
+
+
+
+
+
+
+```
+
diff --git a/src/composables/path.ts b/src/composables/path.ts
index 83449c5..f37ee08 100644
--- a/src/composables/path.ts
+++ b/src/composables/path.ts
@@ -1,4 +1,3 @@
-// TODO README 文档
/**
* base 安全的路径解析
* @param path 路径