feat: 添加 Docker 环境轮询监听支持并优化渲染设置卡片样式

This commit is contained in:
caoxiaozhu
2026-05-09 08:25:54 +00:00
parent 4fbd313f35
commit 6d91528b7c
5 changed files with 64 additions and 23 deletions

View File

@@ -8,12 +8,13 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const rootDir = path.resolve(__dirname, '..')
const envFile = path.join(rootDir, '.env')
const envExampleFile = path.join(rootDir, '.env.example')
const adminSecretDir = path.join(rootDir, 'server', '.secrets')
const adminSecretFile = path.join(adminSecretDir, 'admin.json')
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const rootDir = path.resolve(__dirname, '..')
const envFile = path.join(rootDir, '.env')
const envExampleFile = path.join(rootDir, '.env.example')
const preferPollingWatcher = fs.existsSync('/.dockerenv') || process.env.VITE_USE_POLLING === 'true'
const adminSecretDir = path.join(rootDir, 'server', '.secrets')
const adminSecretFile = path.join(adminSecretDir, 'admin.json')
const adminScryptOptions = { N: 16384, r: 8, p: 1 }
const adminScryptKeyLength = 64
let backendStartPromise = null
@@ -1022,11 +1023,18 @@ function localSetupPlugin() {
export default defineConfig({
envDir: '..',
server: {
watch: {
ignored: [
envFile,
envExampleFile,
server: {
watch: {
...(preferPollingWatcher
? {
// Docker bind mounts can miss fs events for Vue SFCs, which leaves Vite serving stale templates.
usePolling: true,
interval: 250
}
: {}),
ignored: [
envFile,
envExampleFile,
path.join(rootDir, 'server', 'logs', '**')
]
},