fix(build):修复前端打包错误
This commit is contained in:
1 parent
ed674ce989
commit
6aad184283
2 files changed
+17
-2
No files matched your search
@@ -31,7 +31,7 @@ RUN if [ "$VERSION" = "dev" ]; then \
|
||||
fi && \
|
||||
echo "Building frontend with version: ${VERSION}" && \
|
||||
cd admin && VITE_APP_VERSION=$VERSION bun run build && \
|
||||
cd ../tenant && bun run build
|
||||
cd ../tenant && VITE_APP_VERSION=$VERSION bun run build
|
||||
|
||||
# Stage 2: Go build
|
||||
FROM golang:1.25-alpine AS builder
|
||||
|
||||
@@ -3,9 +3,24 @@ import vue from '@vitejs/plugin-vue'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { execSync } from 'node:child_process'
|
||||
import { resolve } from 'node:path'
|
||||
|
||||
const version = readFileSync(resolve(__dirname, '../../VERSION'), 'utf-8').trim()
|
||||
function getVersion(): string {
|
||||
if (process.env.NODE_ENV === 'development') return 'dev'
|
||||
if (process.env.VITE_APP_VERSION) return process.env.VITE_APP_VERSION
|
||||
try {
|
||||
return execSync('git describe --tags --always', { encoding: 'utf-8' }).trim()
|
||||
} catch {
|
||||
try {
|
||||
return readFileSync(resolve(__dirname, '../../VERSION'), 'utf-8').trim()
|
||||
} catch {
|
||||
return 'dev'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const version = getVersion()
|
||||
|
||||
export default defineConfig({
|
||||
base: '/',
|
||||
|
||||
Reference in new issue
Block a user