import { fileURLToPath, URL } from "node:url" import { defineConfig, loadEnv } from "vite" import vue from "@vitejs/plugin-vue" import legacy from "@vitejs/plugin-legacy" import AutoImport from "unplugin-auto-import/vite" import Components from "unplugin-vue-components/vite" import { NaiveUiResolver } from "unplugin-vue-components/resolvers" // 显式保留 Chrome 90 所需的运行时兼容项,避免 plugin-legacy 对每个产物执行 Babel 扫描。 // 升级前端依赖后需要重新审计此列表。 const polyfills = [ "es.aggregate-error.cause", "es.array-buffer.detached", "es.array-buffer.transfer-to-fixed-length", "es.array-buffer.transfer", "es.array.at", "es.array.find-last-index", "es.array.push", "es.array.to-reversed", "es.array.to-sorted", "es.array.to-spliced", "es.array.with", "es.error.cause", "es.iterator.constructor", "es.iterator.drop", "es.iterator.every", "es.iterator.filter", "es.iterator.find", "es.iterator.flat-map", "es.iterator.for-each", "es.iterator.map", "es.iterator.reduce", "es.iterator.some", "es.iterator.to-array", "es.json.parse", "es.json.stringify", "es.map.get-or-insert-computed", "es.map.get-or-insert", "es.object.has-own", "es.regexp.flags", "es.set.difference.v2", "es.set.intersection.v2", "es.set.is-disjoint-from.v2", "es.set.is-subset-of.v2", "es.set.is-superset-of.v2", "es.set.symmetric-difference.v2", "es.set.union.v2", "es.string.at-alternative", "es.typed-array.at", "es.typed-array.find-last-index", "es.typed-array.find-last", "es.typed-array.set", "es.typed-array.to-reversed", "es.typed-array.to-sorted", "es.typed-array.with", "es.uint8-array.set-from-base64", "es.uint8-array.set-from-hex", "es.uint8-array.to-base64", "es.uint8-array.to-hex", "es.weak-map.get-or-insert-computed", "es.weak-map.get-or-insert", "esnext.array.group", "web.dom-exception.stack", "web.immediate", "web.structured-clone", "web.url-search-params.delete", "web.url-search-params.has", "web.url-search-params.size", "web.url.can-parse", ] // MaxKB 脚本**不要**在这里注入 index.html。 // // 原来有个 inject-maxkb 插件把