完善 readiness、发布追溯与敏感治理(07-15-production-trust-closeout-cleanup)
这个提交包含在:
@@ -10,6 +10,8 @@ import { AppRouter } from "./router";
|
||||
import { clearPwaRuntimeCaches, registerPwaIfEnabled } from "./pwa";
|
||||
import "./index.css";
|
||||
|
||||
document.documentElement.dataset.buildSha = String(import.meta.env.VITE_BUILD_SHA || "development").slice(0, 12);
|
||||
|
||||
const CHUNK_RELOAD_ATTEMPTED_KEY = "hyb_oa_chunk_reload_attempted";
|
||||
const CHUNK_LOAD_ERROR_PATTERNS = [
|
||||
"chunkloaderror",
|
||||
|
||||
+18
-2
@@ -1,4 +1,4 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { defineConfig, loadEnv } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { VitePWA } from "vite-plugin-pwa";
|
||||
|
||||
@@ -50,7 +50,22 @@ function resolveManualChunk(id: string) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
function normalizePublicBuildSha(value: string | undefined, fallback: string) {
|
||||
const normalized = String(value ?? "").trim().toLowerCase();
|
||||
return /^[0-9a-f]{7,64}$/.test(normalized) ? normalized.slice(0, 12) : fallback;
|
||||
}
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, ".", "VITE_");
|
||||
const publicBuildSha = normalizePublicBuildSha(
|
||||
env.VITE_BUILD_SHA,
|
||||
mode === "production" ? "unknown" : "development",
|
||||
);
|
||||
|
||||
return {
|
||||
define: {
|
||||
"import.meta.env.VITE_BUILD_SHA": JSON.stringify(publicBuildSha),
|
||||
},
|
||||
plugins: [
|
||||
react(),
|
||||
VitePWA({
|
||||
@@ -157,4 +172,5 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
在新工单中引用
屏蔽一个用户