-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
22 lines (19 loc) · 883 Bytes
/
Copy pathvite.config.ts
File metadata and controls
22 lines (19 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig, loadEnv } from "vite";
import tailwindcss from "@tailwindcss/vite";
import { enhancedImages } from "@sveltejs/enhanced-img";
export default defineConfig(({ mode }) => {
// Load env vars from .env file
const env = loadEnv(mode, process.cwd(), "");
// Populate process.env with loaded env vars for server-side code
// This ensures env vars are available in both SvelteKit and scripts
if (env.CURSOR_BEARER_TOKEN)
process.env.CURSOR_BEARER_TOKEN = env.CURSOR_BEARER_TOKEN;
if (env.X_CURSOR_CLIENT_VERSION)
process.env.X_CURSOR_CLIENT_VERSION = env.X_CURSOR_CLIENT_VERSION;
if (env.X_REQUEST_ID) process.env.X_REQUEST_ID = env.X_REQUEST_ID;
if (env.X_SESSION_ID) process.env.X_SESSION_ID = env.X_SESSION_ID;
return {
plugins: [enhancedImages(), sveltekit(), tailwindcss()],
};
});