-
Notifications
You must be signed in to change notification settings - Fork 26
/
vite.config.ts
65 lines (62 loc) · 2.09 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { defineConfig } from 'vite'
import rubyPlugin from 'vite-plugin-ruby'
import react from '@vitejs/plugin-react'
import { sentryVitePlugin } from '@sentry/vite-plugin'
import { readFileSync } from 'fs'
// Match latest non-draft at https://github.com/broadinstitute/single_cell_portal_core/releases
const version = readFileSync('version.txt', { encoding: 'utf8' })
// sentryVitePlugin should be disabled in local development as it prevents using breakpoints
// to turn off locally, run:
//
// DISABLE_SENTRY=true bin/vite dev
//
// otherwise, this evaluates to false and leaves plugin enabled in all other scenarios
const disableSentry = typeof process.env.DISABLE_SENTRY !== 'undefined' && process.env.DISABLE_SENTRY === 'true'
export default defineConfig({
'define': {
'__SCP_VERSION__': process.env.SCP_VERSION ? process.env.SCP_VERSION : version,
'__FRONTEND_SERVICE_WORKER_CACHE__': process.env.VITE_FRONTEND_SERVICE_WORKER_CACHE,
'__DEV_MODE__': process.env.VITE_DEV_MODE
},
'plugins': [
// inject plugin needs to be first
rubyPlugin(),
react({
jsxRuntime: 'classic'
}),
sentryVitePlugin({
'org': 'broad-institute',
'project': 'single-cell-portal',
'authToken': process.env.SENTRY_AUTH_TOKEN,
'telemetry': false,
'disable': disableSentry
})
],
'resolve': {
'alias': {
'lib/assets/metadata_schemas/alexandria_convention/alexandria_convention_schema.json': 'lib/assets/metadata_schemas/alexandria_convention/alexandria_convention_schema.json'
}
},
'build': {
'sourcemap': true,
'chunkSizeWarningLimit': 4096,
'rollupOptions': {
'output': {
// Safely split out especially large third-party libraries
// Fuller explanation: https://github.com/broadinstitute/single_cell_portal_core/pull/1668
'manualChunks': {
'morpheus-app': ['morpheus-app'],
'plotly.js-dist': ['plotly.js-dist'],
'igv': ['@single-cell-portal/igv']
}
}
}
},
'server': {
'hmr': {
'host': '127.0.0.1',
'protocol': 'ws',
'timeout': 1.0
}
}
})