vite.config.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { defineConfig } from "vite";
  2. import path from "path";
  3. import svgr from "vite-plugin-svgr";
  4. import react from "@vitejs/plugin-react";
  5. import legacy from "@vitejs/plugin-legacy";
  6. import monacoEditor from "vite-plugin-monaco-editor";
  7. export default defineConfig({
  8. root: "src",
  9. server: { port: 3000 },
  10. plugins: [
  11. svgr(),
  12. react(),
  13. legacy({
  14. targets: ["edge>=109", "safari>=13"],
  15. modernPolyfills: true,
  16. polyfills: ["web.structured-clone"],
  17. additionalModernPolyfills: [
  18. path.resolve("./src/polyfills/matchMedia.js"),
  19. path.resolve("./src/polyfills/WeakRef.js"),
  20. path.resolve("./src/polyfills/RegExp.js"),
  21. ],
  22. }),
  23. monacoEditor({
  24. languageWorkers: ["editorWorkerService", "typescript", "css"],
  25. customWorkers: [
  26. {
  27. label: "yaml",
  28. entry: "monaco-yaml/yaml.worker",
  29. },
  30. ],
  31. }),
  32. ],
  33. build: {
  34. outDir: "../dist",
  35. emptyOutDir: true,
  36. },
  37. resolve: {
  38. alias: {
  39. "@": path.resolve("./src"),
  40. "@root": path.resolve("."),
  41. },
  42. },
  43. define: {
  44. OS_PLATFORM: `"${process.platform}"`,
  45. },
  46. });