-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
60 lines (56 loc) · 1.57 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
import {
vitePlugin as remix,
cloudflareDevProxyVitePlugin as remixCloudflareDevProxyVitePlugin,
} from '@remix-run/dev';
import { sentryVitePlugin } from '@sentry/vite-plugin';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
import { defineConfig, loadEnv } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import { z } from 'zod';
import { type ContextEnv, envSchema, getLoadContext } from './server';
export default defineConfig(({ mode }) => {
const viteEnv = loadEnv(mode, process.cwd(), [
'CLIENT_',
'SERVER_',
'SHARED_',
'SENTRY_',
]);
const env = envSchema.parse(viteEnv);
const configEnv = z
.object({
SENTRY_AUTH_TOKEN: z.string(),
})
.parse(viteEnv);
return {
envPrefix: ['CLIENT_', 'SERVER_', 'SHARED_'],
plugins: [
remixCloudflareDevProxyVitePlugin<ContextEnv, CfProperties>({
getLoadContext: (args) =>
getLoadContext(args, {
authCookieSessionSecret: env.SERVER_AUTH_COOKIE_SESSION_SECRET,
}),
}),
remix({
future: {
v3_fetcherPersist: true,
v3_relativeSplatPath: true,
v3_throwAbortReason: true,
},
}),
tsconfigPaths(),
vanillaExtractPlugin(),
sentryVitePlugin({
org: 'majority-elite',
project: 'ort-frontend',
url: 'https://sentry.io/',
authToken: configEnv.SENTRY_AUTH_TOKEN,
sourcemaps: {
filesToDeleteAfterUpload: './build/**/*.map',
},
}),
],
build: {
sourcemap: true,
},
};
});