-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.renderer.config.mts
67 lines (61 loc) · 1.82 KB
/
vite.renderer.config.mts
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
66
67
import type { ConfigEnv, UserConfig } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import { pluginExposeRenderer } from './vite.base.config'
import tsconfigPaths from 'vite-tsconfig-paths'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import { PrimeVueResolver } from '@primevue/auto-import-resolver'
import vitePluginVueDevtool from 'vite-plugin-vue-devtools'
import { sentryVitePlugin } from '@sentry/vite-plugin'
// https://vitejs.dev/config
export default defineConfig((env) => {
console.log('env', env)
const forgeEnv = env as ConfigEnv<'renderer'>
const { root, mode, forgeConfigSelf } = forgeEnv
const name = forgeConfigSelf.name ?? ''
const environment = loadEnv(env.mode, process.cwd(), '')
console.log('environment.SUPABASE_URL', environment.SUPABASE_URL)
const plugins = [
pluginExposeRenderer(name),
tsconfigPaths(),
vue(),
Components({
resolvers: [PrimeVueResolver()]
}),
vitePluginVueDevtool()
// nodePolyfills(),
]
const tag = process.env.GITHUB_REF?.includes('refs/tags/')
console.log('tag', tag)
if (tag) {
plugins.push(
sentryVitePlugin({
org: 'armaldio',
project: 'cyn',
authToken: environment.SENTRY_AUTH_TOKEN
})
)
}
return {
root,
mode,
base: './',
define: {
__SUPABASE_URL__: JSON.stringify(environment.SUPABASE_URL),
__SUPABASE_ANON_KEY__: JSON.stringify(environment.SUPABASE_ANON_KEY),
__SUPABASE_PROJECT_ID__: JSON.stringify(environment.SUPABASE_PROJECT_ID)
},
build: {
outDir: `.vite/renderer/${name}`,
sourcemap: true
},
optimizeDeps: {
include: ['@codemirror/state', '@codemirror/view']
},
plugins,
resolve: {
preserveSymlinks: true
},
clearScreen: false
} as UserConfig
})