build: support running the server with go run during development

- The dev build tag reads web/dist from disk instead of embedding it,
  so the backend starts without building the frontend first; Vite
  serves the UI and proxies /api and WebSocket to the Go server
- Document the two-terminal dev workflow and ignore .dev-data/
This commit is contained in:
eezd committed 2026-10-16 18:46:13 +08:00
1 parent bfe0a0654d
commit dc7e43bc3c
4 files changed
+36 -4

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
//go:build dev
package web
import (
"io/fs"
"os"
)
// Dist 在开发模式下直接读取磁盘上的 web/dist(未构建时为空,页面由 Vite 开发服务器提供),
// 因此无需先构建前端即可 go run
func Dist() fs.FS {
return os.DirFS("web/dist")
}