From ed85823e16fd59bb008db7c9c17c4135064194fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=9F=E4=BA=8C=E8=BF=9C?= Date: Wed, 8 Apr 2026 13:08:49 +0800 Subject: [PATCH] =?UTF-8?q?feat=20:=20=E8=B0=83=E6=95=B4=E9=80=82=E9=85=8D?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E9=98=BF=E9=87=8C=E4=BA=91=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/Dockerfile | 1 + web/src/bootstrap.ts | 3 ++- web/vite.config.ts | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/web/Dockerfile b/web/Dockerfile index 1d6bd8ff..a6603894 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -4,6 +4,7 @@ WORKDIR /app COPY package.json pnpm-lock.yaml ./ RUN pnpm install --frozen-lockfile COPY . . +ENV VITE_BASE_PATH=/skillhub-web/ RUN pnpm build FROM jsessh-registry.cn-shanghai.cr.aliyuncs.com/base-images/nginx-skillhub:alpine diff --git a/web/src/bootstrap.ts b/web/src/bootstrap.ts index 8c8ddc6c..b813de02 100644 --- a/web/src/bootstrap.ts +++ b/web/src/bootstrap.ts @@ -7,7 +7,8 @@ async function loadRuntimeConfig() { await new Promise((resolve, reject) => { const script = document.createElement('script') - script.src = '/runtime-config.js' + const base = new URL('./', document.baseURI).pathname + script.src = `${base}runtime-config.js` script.async = false script.onload = () => resolve() script.onerror = () => reject(new Error('Failed to load runtime config')) diff --git a/web/vite.config.ts b/web/vite.config.ts index 3b2eb055..caac3178 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -3,6 +3,7 @@ import react from '@vitejs/plugin-react' import * as path from 'path' export default defineConfig({ + base: process.env.VITE_BASE_PATH || '/', plugins: [react()], resolve: { alias: {