From f46da4da0007cb5f11c8875ea74f10e18b6878a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=96=9B=E5=AE=B6=E8=B1=AA?= Date: Fri, 26 Sep 2025 10:18:16 +0000 Subject: [PATCH] Update README.md --- README.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e6f3b3b..54f3209 100644 --- a/README.md +++ b/README.md @@ -58,14 +58,14 @@ include_toc: true ## 1. 修改 baseUrl -> 参考这个 commit: https://git.alicorns.co.jp/xuejiahao/website-products/commit/98dac11ece9c262b24376a3ff1227731b0ff96fd +> 参考这个 commit: https://git.alicorns.co.jp/xuejiahao/website-products/commit/8dd1e3c34f4633f8fae7f3ade0513b6c6c1f1822 1. `main.tsx` ```diff createRoot(document.getElementById("root")!).render( # <---- 检查必须是 #root - -+ ++ # <---- 需要和项目文件夹名一致 @@ -73,10 +73,15 @@ createRoot(document.getElementById("root")!).render( # <---- 检查必须是 #r 2. `vite.config.ts` ```diff -export default defineConfig({ - plugins: getPlugins() -+ base: '/alisurvey', # <---- 需要和项目文件夹名一致 -}); +-export default defineConfig({ +- plugins: getPlugins() +-}); ++export default defineConfig(({ command }) => ({ ++ plugins: getPlugins(), ++ base: command === 'build' ++ ? '/wp-content/products/react-apps/alisurvey/' # <---- 存放到 wordpress 的路径,末尾需要 / ++ : '/alisurvey' # <---- 本地用,需要和项目文件夹名一致 ++})); ``` ## 2. 修改 pnpm 为 npm [可选]