-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
21 lines (19 loc) · 745 Bytes
/
Copy pathvite.config.ts
File metadata and controls
21 lines (19 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig(({ mode }) => {
// Fail the build/dev-server startup immediately if VITE_API_BASE_URL is
// missing, instead of silently shipping a bundle with no configured API
// base URL (which would only surface as a runtime error in the browser).
const env = loadEnv(mode, process.cwd(), 'VITE_')
if (!env.VITE_API_BASE_URL) {
throw new Error(
'Missing required environment variable VITE_API_BASE_URL. ' +
'Set it in your .env.local for local development, or as a build-time ' +
'variable in CI/CD before running `vite build`.'
)
}
return {
plugins: [react()],
}
})