chore(frontend): avoid loading CSS twice in vite dev mode (#39160)

This commit is contained in:
silverwind
2026-08-28 22:57:08 +02:00
committed by GitHub
parent 453c38d7d6
commit 1652dfe62a
3 changed files with 14 additions and 9 deletions
+5 -2
View File
@@ -142,13 +142,16 @@ func IsViteDevMode() bool {
// viteDevSourceURL returns the dev server URL for a source file, or "" if it doesn't exist.
func viteDevSourceURL(srcPath string) string {
localPath := util.FilePathJoinAbs(setting.StaticRootPath, srcPath)
if _, err := os.Stat(localPath); err != nil {
if _, err := os.Stat(viteDevModuleID(srcPath)); err != nil {
return ""
}
return setting.AppSubURL + "/" + srcPath
}
func viteDevModuleID(srcPath string) string {
return filepath.ToSlash(util.FilePathJoinAbs(setting.StaticRootPath, srcPath))
}
// IsViteDevRequest returns true if the request should be proxied to the Vite dev server.
// Ref: Vite source packages/vite/src/node/constants.ts and packages/vite/src/shared/constants.ts
func IsViteDevRequest(req *http.Request) bool {