From a185de5e3686659f8b8713cc7aa40d08bfa6787c Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Tue, 14 Oct 2025 19:23:54 +0800 Subject: [PATCH] build(ui): adjust babel tagets --- ui/src/utils/browser.ts | 1 + ui/vite.config.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ui/src/utils/browser.ts b/ui/src/utils/browser.ts index 911e55277..9daaec2a9 100644 --- a/ui/src/utils/browser.ts +++ b/ui/src/utils/browser.ts @@ -1,6 +1,7 @@ export const isBrowserHappy = () => { try { if (typeof Promise.withResolvers !== "function") return false; + if (typeof Promise.try !== "function") return false; if (typeof CSS.supports !== "function") return false; if (!CSS.supports("color", "oklch(0 0 0)")) return false; } catch (_) { diff --git a/ui/vite.config.ts b/ui/vite.config.ts index 2ea3a34e0..d07781bf3 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -56,6 +56,11 @@ export default defineConfig(({ mode }) => { reactPlugin({}), legacyPlugin({ targets: ["defaults", "not IE 11"], + modernTargets: "chrome>=111, firefox>=113, safari>=15.4", + polyfills: true, + modernPolyfills: true, + renderLegacyChunks: false, + renderModernChunks: true, }), tailwindcssPlugin(), preserveFilesPlugin(["dist/.gitkeep"]),