-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathvite.stdio.config.ts
More file actions
39 lines (37 loc) · 1.25 KB
/
vite.stdio.config.ts
File metadata and controls
39 lines (37 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
import { defineConfig } from 'vite';
import path from 'node:path';
// Load .env file at build time (for npm run make)
// In development, variables may be pre-set by shell which take precedence
// In CI/CD, GitHub Actions/GitLab CI exports variables which take precedence
// Safe import: only load dotenv if available (may not be in CI)
try {
const dotenv = await import('dotenv');
dotenv.config();
} catch {
// dotenv not available (CI environment) - environment variables already set
console.log('dotenv not available, using existing environment variables');
}
// https://vitejs.dev/config
export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
define: {
// Inject environment variables at build time for stdio server
// These will be replaced with literal values in the bundled code
'__FIGMA_CLIENT_ID__': JSON.stringify(process.env.FIGMA_CLIENT_ID || ''),
'__FIGMA_CLIENT_SECRET__': JSON.stringify(process.env.FIGMA_CLIENT_SECRET || ''),
},
build: {
rollupOptions: {
// Mark optional ws dependencies as external
external: ['bufferutil', 'utf-8-validate'],
output: {
format: 'cjs',
entryFileNames: 'mcp-stdio-server.cjs',
},
},
},
});