-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.config.ts
32 lines (29 loc) · 964 Bytes
/
vite.config.ts
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
/* eslint-disable import/no-extraneous-dependencies */
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react-swc';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const envVars = loadEnv(mode, process.cwd(), '');
if (!envVars.NB_API_QUERY_URL) {
throw new Error('Environment variable NB_API_QUERY_URL is not defined.');
}
if (envVars.NB_ENABLE_AUTH && envVars.NB_ENABLE_AUTH.toLowerCase() === 'true') {
if (!envVars.NB_QUERY_CLIENT_ID) {
throw new Error('Environment variable NB_QUERY_CLIENT_ID is not defined.');
}
}
return {
preview: {
port: 5173,
strictPort: true,
host: true,
},
plugins: [react()],
envPrefix: 'NB_',
// Excluding the Auth0 library from the bundle to avoid issues with
// Cypress component tests. TODO: understand why this is necessary
optimizeDeps: {
exclude: ['@auth0/auth0-react'],
},
};
});