-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
55 lines (42 loc) · 1.48 KB
/
vite.config.js
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { sveltekit } from '@sveltejs/kit/vite'
import path from 'path'
import { defineConfig } from 'vitest/config'
const mode = process.env.NODE_ENV
const dev = mode !== 'production'
process.env.MEDIA_PATH = '/webkit'
process.env.ICONS_PATH = process.env.MEDIA_PATH + '/icons'
const BACKEND_URL = process.env.BACKEND_URL || 'https://api-stage.santiment.net'
process.env.BACKEND_URL = BACKEND_URL
const GQL_SERVER_FALLBACK = process.env.BACKEND_URL + '/graphql'
const IS_STAGE_BACKEND = process.env.BACKEND_URL.includes('-stage')
const IS_PROD_BACKEND = !IS_STAGE_BACKEND
export default defineConfig({
plugins: [sveltekit()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}'],
environment: 'happy-dom',
},
server: {
port: 3000,
},
resolve: {
alias: [
{ find: '@', replacement: path.resolve(__dirname, './src') },
{ find: 'webkit', replacement: path.resolve(__dirname, './src') },
],
},
define: {
'process.browser': false,
'process.env.IS_DEV_MODE': dev,
'process.env.IS_PROD_MODE': !dev,
'process.env.MEDIA_PATH': JSON.stringify(process.env.MEDIA_PATH),
'process.env.ICONS_PATH': JSON.stringify(process.env.ICONS_PATH),
'process.env.BACKEND_URL': JSON.stringify(process.env.BACKEND_URL),
'process.env.GQL_SERVER_URL': JSON.stringify(GQL_SERVER_FALLBACK),
'process.env.IS_STAGE_BACKEND': IS_STAGE_BACKEND,
'process.env.IS_PROD_BACKEND': IS_PROD_BACKEND,
},
clientDefines: {
'process.browser': true,
},
})