-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
35 lines (33 loc) · 1.06 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
import { defineConfig, loadEnv } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'
import react from '@vitejs/plugin-react'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
// Load env file based on `mode` in the current working directory.
// Set the third parameter to '' to load all env regardless of the `VITE_` prefix.
const env = loadEnv(mode, process.cwd(), '')
return {
define: {
__API_KEY__: JSON.stringify(env.API_KEY),
__AUTH_DOMAIN__: JSON.stringify(env.AUTH_DOMAIN),
__PROJECT_ID__: JSON.stringify(env.PROJECT_ID),
__STORAGE_BUCKET__: JSON.stringify(env.STORAGE_BUCKET),
__MESSAGING_SENDER_ID__: JSON.stringify(env.MESSAGING_SENDER_ID),
__APP_ID__: JSON.stringify(env.APP_ID),
__MEASUREMENT_ID__: JSON.stringify(env.MEASUREMENT_ID)
},
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
injectRegister: 'auto'
})
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src/')
}
}
}
})