Files
bj_power/bj_power_mes/frontend/vite.config.js
T
SunYF d92ca803d5 feat: 来料检处置项实体与复检、日排产达成对比、PLC/WMS 传输日志
- WMS 新增「检验处置项」实体(schema + ent 生成码),配套检验记录实体调整与复检接口,完善来料检/不良退货/入库检验前端
- MES 日排产:新增达成率统计与计划对比逻辑,调整日排产前端与流程卡/工序流
- 日志与传输:MES 新增 PLC 日志与 WMS 客户端传输日志,WMS 新增 MES 客户端传输日志
- MES 其他:扫码、工单/工件、AGV 客户端与告警、产品导入等逻辑完善及前端调整
- 工位终端:上线面板/作业面板、工件 handler 与 MES 客户端调整
- 配置与文档:更新 mes-api.yaml、三端构建产物与问题记录文档
2026-11-16 16:42:44 +08:00

43 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import fs from 'node:fs'
import path from 'node:path'
// 后端端口单一真源:读后端 yaml 顶层 Port(改端口只改 etc/*.yaml 一处,开发态 proxy 自动联动)。
// 仅 npm run dev 时生效;npm run build 产物与 Go 网关同源,proxy 不参与。读不到时回退 fallback(行为不变)。
function backendPort(yamlRel, fallback) {
try {
const yamlPath = path.resolve(process.cwd(), yamlRel)
const m = fs.readFileSync(yamlPath, 'utf-8').match(/^Port:\s*(\d+)\s*$/m)
if (m) return Number(m[1])
} catch (e) {
console.warn(`[vite.config] 未读到 ${yamlRel} 的 Port,proxy 回退 ${fallback}`)
}
return fallback
}
const apiTarget = `http://localhost:${backendPort('../etc/bj_power_mes-api.yaml', 8888)}`
// 构建产物直接写入 Go 嵌入静态目录(main.go go:embed public)
export default defineConfig({
plugins: [vue()],
// 绝对路径:访问 /board 或 /board/ 时资源都从 /assets/ 加载,
// 避免相对路径 ./assets 在子路径下被解析成 /board/assets 而回退成 index.html(MIME 错、白屏)。
base: '/',
build: {
outDir: '../public',
// outDir 在 root 外,vite 默认不清空会堆积旧 chunk;设 true 让每次 build 先清空再写,避免嵌入 exe 携带冗余体积。
emptyOutDir: true
},
server: {
port: 7070,
host: true,
proxy: {
'/api': {
target: apiTarget,
changeOrigin: true
}
}
}
})