Spaces:
Sleeping
Sleeping
| import { defineConfig } from "vite"; | |
| import react from "@vitejs/plugin-react"; | |
| import path from "path"; | |
| import legacy from "@vitejs/plugin-legacy"; | |
| // https://vitejs.dev/config/ | |
| export default defineConfig({ | |
| plugins: [ | |
| react({ | |
| babel: { | |
| plugins: [ | |
| "@babel/plugin-proposal-optional-chaining", // 兼容老版本浏览器的语法解译 | |
| ], | |
| }, | |
| }), | |
| legacy({ | |
| targets: ["defaults", "ie >= 11", "chrome >= 52"], //需要兼容的目标列表,可以设置多个 | |
| additionalLegacyPolyfills: ["regenerator-runtime/runtime"], | |
| renderLegacyChunks: true, | |
| polyfills: [ | |
| "es.symbol", | |
| "es.array.filter", | |
| "es.promise", | |
| "es.promise.finally", | |
| "es/map", | |
| "es/set", | |
| "es.array.for-each", | |
| "es.object.define-properties", | |
| "es.object.define-property", | |
| "es.object.get-own-property-descriptor", | |
| "es.object.get-own-property-descriptors", | |
| "es.object.keys", | |
| "es.object.to-string", | |
| "web.dom-collections.for-each", | |
| "esnext.global-this", | |
| "esnext.string.match-all", | |
| ], | |
| }), | |
| ], | |
| build: { | |
| target: "es5", | |
| }, | |
| resolve: { | |
| alias: { | |
| "@": path.resolve(__dirname, "src"), | |
| }, | |
| }, | |
| css: { | |
| modules: { | |
| localsConvention: "camelCase", | |
| }, | |
| }, | |
| server: { | |
| port: 8080, | |
| proxy: { | |
| "/solve": { | |
| target: "", | |
| changeOrigin: true, | |
| }, | |
| }, | |
| }, | |
| }); | |