-
Notifications
You must be signed in to change notification settings - Fork 5
/
vite.config.ts
38 lines (36 loc) · 1.37 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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import viteTsconfigPaths from 'vite-tsconfig-paths'
import { execSync } from 'child_process';
import EnvironmentPlugin from "vite-plugin-environment"
const commitHash = execSync('git rev-parse HEAD').toString().trimEnd();
const shortCommitHash = execSync('git rev-parse --short HEAD').toString().trimEnd();
//const commitDate = execSync('git log -1 --format=%cI').toString().trimEnd();
//const branchName = execSync('git rev-parse --abbrev-ref HEAD').toString().trimEnd();
//const lastCommitMessage = execSync('git show -s --format=%s').toString().trimEnd();
export default defineConfig({
// depending on your application, base can also be "/"
base: '',
plugins: [
// here is the main update
react({
jsxImportSource: '@emotion/react',
babel: {
plugins: ['@emotion/babel-plugin'],
},
}),
viteTsconfigPaths(),
EnvironmentPlugin("all")
],
define: {
'process.platform': JSON.stringify(process.platform),
"process.env.VITE_GIT_COMMIT_HASH": JSON.stringify(commitHash),
"process.env.VITE_GIT_SHORT_COMMIT_HASH": JSON.stringify(shortCommitHash),
},
server: {
// this ensures that the browser opens upon server start
open: true,
// this sets a default port to 3000
port: 3000,
},
})