feat : 调整适配部署阿里云效

This commit is contained in:
翟二远 2026-04-08 13:08:49 +08:00
parent 1dabd01ba7
commit ed85823e16
3 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -7,7 +7,8 @@
async function loadRuntimeConfig() {
await new Promise<void>((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'))

View file

@ -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: {