-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
26 lines (24 loc) · 868 Bytes
/
Copy pathvite.config.js
File metadata and controls
26 lines (24 loc) · 868 Bytes
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
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
export default defineConfig(({ mode }) => {
// Vite exposes `import.meta.env.VITE_*` for env vars it has loaded, but we
// want the PostHog values guaranteed to reach the bundle even if the loader
// skips them. Pull them out with loadEnv and re-inject as build-time literals.
const env = loadEnv(mode, process.cwd(), "");
return {
base: "/",
plugins: [react(), tailwindcss()],
define: {
"import.meta.env.VITE_POSTHOG_PROJECT_TOKEN": JSON.stringify(
env.VITE_POSTHOG_PROJECT_TOKEN
),
"import.meta.env.VITE_POSTHOG_HOST": JSON.stringify(env.VITE_POSTHOG_HOST),
},
test: {
environment: "jsdom",
globals: true,
setupFiles: "./src/test/setup.js",
},
};
});