-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
43 lines (40 loc) · 1.25 KB
/
vite.config.ts
File metadata and controls
43 lines (40 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
// https://vite.dev/config/
export default defineConfig(({ mode }) => ({
plugins: [
react(),
// The code below enables dev tools like taking screenshots of your site
// while it is being developed on chef.convex.dev.
// Feel free to remove this code if you're no longer developing your app with Chef.
mode === "development"
? {
name: "inject-chef-dev",
transform(code: string, id: string) {
if (id.includes("main.tsx")) {
return {
code: `${code}
/* Added by Vite plugin inject-chef-dev */
window.addEventListener('message', async (message) => {
if (message.source !== window.parent) return;
if (message.data.type !== 'chefPreviewRequest') return;
const worker = await import('https://chef.convex.dev/scripts/worker.bundled.mjs');
await worker.respondToMessage(message);
});
`,
map: null,
};
}
return null;
},
}
: null,
// End of code for taking screenshots on chef.convex.dev.
].filter(Boolean),
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
}));