mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-08 14:03:24 +09:00
chore(frontend): avoid loading CSS twice in vite dev mode (#39160)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user