chore: inject Object.hasOwn polyfill for Console and UC (#7128)

#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

Inject Object.hasOwn polyfill into the front-end projects of Console and UC to solve the problem that some features cannot be used normally in lower version browsers

See https://github.com/halo-dev/halo/issues?q=is%3Aissue%20state%3Aclosed%20hasOwn
See https://caniuse.com/?search=hasOwn

#### Does this PR introduce a user-facing change?

```release-note
修复在较低版本浏览器中无法使用默认编辑器和附件上传功能的问题。
```
pull/7127/head^2
Ryan Wang 2024-12-16 00:10:06 +08:00 committed by GitHub
parent 0748ae4334
commit 0e9466d29c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1518 additions and 197 deletions

View File

@ -117,6 +117,7 @@
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@types/randomstring": "^1.1.8", "@types/randomstring": "^1.1.8",
"@types/ua-parser-js": "^0.7.39", "@types/ua-parser-js": "^0.7.39",
"@vitejs/plugin-legacy": "^6.0.0",
"@vitejs/plugin-vue": "^5.1.4", "@vitejs/plugin-vue": "^5.1.4",
"@vitejs/plugin-vue-jsx": "^4.0.1", "@vitejs/plugin-vue-jsx": "^4.0.1",
"@vitest/ui": "^0.34.1", "@vitest/ui": "^0.34.1",
@ -145,6 +146,7 @@
"tailwindcss": "^3.2.7", "tailwindcss": "^3.2.7",
"tailwindcss-safe-area": "^0.2.2", "tailwindcss-safe-area": "^0.2.2",
"tailwindcss-themer": "^2.0.3", "tailwindcss-themer": "^2.0.3",
"terser": "^5.37.0",
"typescript": "~5.6.2", "typescript": "~5.6.2",
"unplugin-icons": "^0.19.2", "unplugin-icons": "^0.19.2",
"vite": "^5.4.1", "vite": "^5.4.1",

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,8 @@ import { defineConfig, type Plugin } from "vite";
import { VitePWA } from "vite-plugin-pwa"; import { VitePWA } from "vite-plugin-pwa";
import { setupLibraryExternal } from "./library-external"; import { setupLibraryExternal } from "./library-external";
import legacy from "@vitejs/plugin-legacy";
interface Options { interface Options {
base: string; base: string;
entryFile: string; entryFile: string;
@ -43,6 +45,11 @@ export const sharedPlugins = [
}, },
disable: true, disable: true,
}), }),
legacy({
targets: ["defaults", "not IE 11"],
polyfills: ["es/object/has-own"],
modernPolyfills: ["es/object/has-own"],
}),
]; ];
export function createViteConfig(options: Options) { export function createViteConfig(options: Options) {