-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
vite.renderer.config.ts
46 lines (41 loc) · 1.41 KB
/
vite.renderer.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
import type { ConfigEnv, PluginOption, UserConfig } from 'vite';
import { defineConfig } from 'vite';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
import svgr from "vite-plugin-svgr";
import dotenv from 'dotenv';
import { pluginExposeRenderer } from './vite.base.config.js';
// applies env vars from .env file(s)
dotenv.config();
console.log("vite.renderer.config.ts");
// https://vitejs.dev/config
export default defineConfig((env) => {
const forgeEnv = env as ConfigEnv<'renderer'>;
const { root, mode, forgeConfigSelf } = forgeEnv;
const name = forgeConfigSelf?.name ?? '';
const plugins: PluginOption[] = []
if(process.env.NODE_ENV !== 'test') {
plugins.push(pluginExposeRenderer(name))
}
plugins.push(vanillaExtractPlugin(), svgr())
console.log("vite.renderer.config.ts plugins: ", plugins);
return {
root,
mode,
base: './',
build: {
outDir: `.vite/renderer/${name}`,
publicDir: 'assets'
},
plugins,
resolve: {
preserveSymlinks: true,
},
clearScreen: false,
define: {
'import.meta.env.MP_PROJECT_TOKEN': JSON.stringify(process.env.MP_PROJECT_TOKEN),
'import.meta.env.MP_PROJECT_ENV': JSON.stringify(process.env.MP_PROJECT_ENV),
'import.meta.env.NICENODE_ENV': JSON.stringify(process.env.NICENODE_ENV),
'import.meta.env.SENTRY_DSN': JSON.stringify(process.env.SENTRY_DSN),
}
} as UserConfig;
});