修复 bug

This commit is contained in:
eafonyang
2026-06-12 15:58:08 +08:00
parent 56a76e68ef
commit 1b0b447eee
10 changed files with 135 additions and 20 deletions
+18
View File
@@ -8,6 +8,23 @@ import { vitePluginManusRuntime } from "vite-plugin-manus-runtime";
const PROJECT_ROOT = import.meta.dirname;
/** Dev: / → i.modern.html; /i.html → UA router entry */
function vitePluginModernDevEntry(): Plugin {
return {
name: "modern-dev-entry",
apply: "serve",
configureServer(server) {
server.middlewares.use((req, _res, next) => {
const url = (req.url ?? "").split("?")[0];
if (url === "/" || url === "/index.html") {
req.url = "/i.modern.html";
}
next();
});
},
};
}
/** 构建后将统一入口 i.html 复制到 dist/ 根目录 */
function vitePluginCopyRouterEntry(): Plugin {
const src = path.resolve(import.meta.dirname, "client", "i.html");
@@ -24,6 +41,7 @@ function vitePluginCopyRouterEntry(): Plugin {
}
const plugins = [
vitePluginModernDevEntry(),
react(),
tailwindcss(),
jsxLocPlugin(),