Files
RawMark/web/embed.go
T
eezd dc7e43bc3c 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/
2026-10-16 18:46:13 +08:00

22 lines
433 B
Go

//go:build !dev
// Package web 把前端构建产物(web/dist,由 npm run build 生成)嵌入 Go 二进制。
// 开发时使用 -tags dev,前端由 Vite 开发服务器提供,见 embed_dev.go。
package web
import (
"embed"
"io/fs"
)
//go:embed all:dist
var dist embed.FS
func Dist() fs.FS {
sub, err := fs.Sub(dist, "dist")
if err != nil {
panic(err) // 路径为编译期常量,不会失败
}
return sub
}