-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
39 lines (35 loc) · 1.04 KB
/
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
33
34
35
36
37
38
39
/// <reference types="vite/client" />
import react from '@vitejs/plugin-react';
import { execSync } from 'child_process';
import { copyFileSync, existsSync } from 'fs';
import path from 'path';
import { defineConfig } from 'vite';
import packageJson from './package.json' with { type: 'json' };
if (!existsSync('.env')) {
copyFileSync('.env.defaults', '.env');
}
let gitHash;
try {
gitHash = execSync('git rev-parse --short HEAD').toString().trim();
} catch (_err) {
gitHash = 'unknown'; // Default value when not in a git repository
}
process.env.MEDPLUM_VERSION = packageJson.version + '-' + gitHash;
export default defineConfig({
envPrefix: ['MEDPLUM_', 'GOOGLE_', 'RECAPTCHA_'],
plugins: [react()],
server: {
port: 3300,
},
publicDir: 'static',
build: {
sourcemap: true,
},
resolve: {
alias: {
// '@medplum/core': path.resolve(__dirname, '../core/src'),
// '@medplum/react': path.resolve(__dirname, '../react/src'),
// '@medplum/react-hooks': path.resolve(__dirname, '../react-hooks/src'),
},
},
});