From 7c27b5bd649e22822c55197d27582fb864add2d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=98=8E=E5=AF=8C?= <212149997@qq.com> Date: Thu, 31 Oct 2024 14:39:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dgithub=20pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 4 ++-- vite.config.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5455f8c..1aec03b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -70,13 +70,13 @@ jobs: - name: Build blog project run: | echo ${{ github.workspace }} - pnpm run build:pro + pnpm run build:dev # 资源拷贝 - name: Build with Jekyll uses: actions/jekyll-build-pages@v1 with: - source: ./dist-pro + source: ./dist-dev destination: ./_site # 上传 _site 的资源,用于后续部署 diff --git a/vite.config.ts b/vite.config.ts index f7a4f3b..79fb449 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -9,6 +9,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { // 获取`.env`环境配置文件 const env = loadEnv(mode, process.cwd()); return { + base: env.VITE_NODE_ENV === 'develop' ? '/react-ts-template/' : undefined, // 只为github pages 配置,自行删除 plugins: [react()], resolve: { alias: {