clash-verge-rev/vite.config.ts

48 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-12-08 23:34:23 +08:00
import { defineConfig } from "vite";
2022-08-06 02:35:11 +08:00
import path from "path";
2022-03-30 12:36:39 +08:00
import svgr from "vite-plugin-svgr";
2021-12-08 23:34:23 +08:00
import react from "@vitejs/plugin-react";
2024-05-29 09:39:26 +08:00
import legacy from "@vitejs/plugin-legacy";
import monacoEditor from "vite-plugin-monaco-editor";
2021-12-08 23:34:23 +08:00
export default defineConfig({
root: "src",
2022-09-02 01:35:06 +08:00
server: { port: 3000 },
2022-07-05 00:52:22 +08:00
plugins: [
svgr(),
react(),
2024-05-29 09:39:26 +08:00
legacy({
targets: ["edge>=109", "safari>=13"],
modernPolyfills: true,
polyfills: ["web.structured-clone"],
additionalModernPolyfills: [
2024-05-30 20:27:12 +08:00
path.resolve("./src/polyfills/matchMedia.js"),
2024-05-29 09:39:26 +08:00
path.resolve("./src/polyfills/WeakRef.js"),
path.resolve("./src/polyfills/RegExp.js"),
],
}),
monacoEditor({
2024-05-13 22:58:25 +08:00
languageWorkers: ["editorWorkerService", "typescript", "css"],
customWorkers: [
{
label: "yaml",
entry: "monaco-yaml/yaml.worker",
},
],
}),
2022-07-05 00:52:22 +08:00
],
2021-12-12 00:39:28 +08:00
build: {
outDir: "../dist",
2021-12-22 01:15:04 +08:00
emptyOutDir: true,
2021-12-12 00:39:28 +08:00
},
2022-08-06 02:35:11 +08:00
resolve: {
alias: {
"@": path.resolve("./src"),
"@root": path.resolve("."),
},
},
define: {
2023-01-14 12:07:31 +08:00
OS_PLATFORM: `"${process.platform}"`,
},
2021-12-08 23:34:23 +08:00
});