From 6e253ae11d141043fc0a454bf23e6bc597d4d121 Mon Sep 17 00:00:00 2001 From: yanghao05 Date: Fri, 25 Apr 2025 21:30:02 +0800 Subject: [PATCH] feat: update issues --- backend/app/service/http/http.go | 10 +++++++++- frontend/wechat/src/main.js | 2 +- frontend/wechat/src/{style.css => styles.css} | 0 frontend/wechat/vite.config.js | 10 ---------- 4 files changed, 10 insertions(+), 12 deletions(-) rename frontend/wechat/src/{style.css => styles.css} (100%) diff --git a/backend/app/service/http/http.go b/backend/app/service/http/http.go index f73087f..f95a568 100644 --- a/backend/app/service/http/http.go +++ b/backend/app/service/http/http.go @@ -2,6 +2,7 @@ package http import ( "context" + "mime" "path/filepath" appHttp "quyun/app/http" @@ -125,10 +126,17 @@ func Serve(cmd *cobra.Command, args []string) error { if f == "/" || f == "" { f = "index.html" } + ext := filepath.Ext(f) + mime := mime.TypeByExtension(ext) + log.Infof("mime type: %s %s", ext, mime) + ctx.Set(fiber.HeaderContentType, mime) file, err := fabfile.Find(filepath.Join("frontend/wechat/dist", f)) if err != nil { - return ctx.SendStatus(fiber.StatusNotFound) + file, err = fabfile.Find(filepath.Join("frontend/wechat/dist", "index.html")) + if err != nil { + return ctx.SendStatus(fiber.StatusNotFound) + } } return ctx.SendFile(file) }) diff --git a/frontend/wechat/src/main.js b/frontend/wechat/src/main.js index 7e447ef..cbe76c4 100644 --- a/frontend/wechat/src/main.js +++ b/frontend/wechat/src/main.js @@ -2,7 +2,7 @@ import { createPinia } from 'pinia'; import { createApp } from 'vue'; import App from './App.vue'; import { router } from './router.js'; -import './style.css'; +import './styles.css'; const app = createApp(App) diff --git a/frontend/wechat/src/style.css b/frontend/wechat/src/styles.css similarity index 100% rename from frontend/wechat/src/style.css rename to frontend/wechat/src/styles.css diff --git a/frontend/wechat/vite.config.js b/frontend/wechat/vite.config.js index a1c2598..0a24313 100644 --- a/frontend/wechat/vite.config.js +++ b/frontend/wechat/vite.config.js @@ -4,16 +4,6 @@ import { resolve } from 'path'; import { defineConfig } from 'vite'; export default defineConfig({ - build: { - rollupOptions: { - output: { - chunkFileNames: 'static/assets/js/[name]-[hash].js', - entryFileNames: 'static/assets/js/[name]-[hash].js', - assetFileNames: 'static/assets/[ext]/[name]-[hash].[ext]', - } - } - }, - base: "./", minify: true, sourceMap: true, plugins: [