| 1 | import { sentryVitePlugin } from "@sentry/vite-plugin"; |
| 2 | import react from "@vitejs/plugin-react-swc"; |
| 3 | import { resolve } from "path"; |
| 4 | import tailwindcss from "tailwindcss"; |
| 5 | import { defineConfig } from "vitest/config"; |
| 6 | |
| 7 | // https://vitejs.dev/config/ |
| 8 | export default defineConfig({ |
| 9 | plugins: [ |
| 10 | react(), |
| 11 | tailwindcss(), |
| 12 | sentryVitePlugin({ |
| 13 | org: "continue-xd", |
| 14 | project: "continue", |
| 15 | }), |
| 16 | ], |
| 17 | build: { |
| 18 | sourcemap: true, |
| 19 | |
| 20 | // Change the output .js filename to not include a hash |
| 21 | rollupOptions: { |
| 22 | input: { |
| 23 | index: resolve(__dirname, "index.html"), |
| 24 | indexConsole: resolve(__dirname, "indexConsole.html"), |
| 25 | }, |
| 26 | output: { |
| 27 | entryFileNames: `assets/[name].js`, |
| 28 | chunkFileNames: `assets/[name].js`, |
| 29 | assetFileNames: `assets/[name].[ext]`, |
| 30 | }, |
| 31 | }, |
| 32 | }, |
| 33 | server: { |
| 34 | cors: { |
| 35 | origin: "*", |
| 36 | methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"], |
| 37 | allowedHeaders: ["*", "Content-Type", "Authorization"], |
| 38 | credentials: true, |
| 39 | }, |
| 40 | }, |
| 41 | test: { |
| 42 | globals: true, |
| 43 | environment: "jsdom", |
| 44 | setupFiles: "./src/util/test/setupTests.ts", |
| 45 | onConsoleLog(log, type) { |
| 46 | if (type === "stderr") { |
| 47 | if ( |
| 48 | [ |
| 49 | "contentEditable", |
| 50 | "An update to Chat inside a test was not wrapped in act", |
| 51 | "An update to TipTapEditor inside a test was not wrapped in act", |
| 52 | "An update to ThinkingIndicator inside a test was not wrapped in act", |
| 53 | "The current testing environment is not configured to support act", |
| 54 | "target.getClientRects is not a function", |
| 55 | "prosemirror", |
| 56 | ].some((text) => log.includes(text)) |
| 57 | ) { |
| 58 | return false; |
| 59 | } |
| 60 | } |
| 61 | return true; |
| 62 | }, |
| 63 | onUnhandledRejection(err) { |
| 64 | // Suppress ProseMirror DOM errors in test environment |
| 65 | if ( |
| 66 | err.message?.includes("getClientRects") || |
| 67 | err.message?.includes("prosemirror") |
| 68 | ) { |
| 69 | return false; |
| 70 | } |
| 71 | return true; |
| 72 | }, |
| 73 | }, |
| 74 | }); |