-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.ts
More file actions
58 lines (54 loc) · 1.7 KB
/
vite.config.ts
File metadata and controls
58 lines (54 loc) · 1.7 KB
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
import { sentryConfig } from './app/utils/config/sentry.config';
import { reactRouter } from '@react-router/dev/vite';
import { sentryReactRouter } from '@sentry/react-router';
import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
import { reactRouterHonoServer } from 'react-router-hono-server/dev';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
// Workaround for issue with running react router in a production build
//
// See: https://github.com/remix-run/react-router/issues/12568#issuecomment-2629986004
export default defineConfig((config) => {
const isProduction = process.env.NODE_ENV === 'production';
const aliases: { [key: string]: string } = {
'@': resolve(__dirname, './app'),
};
if (isProduction) {
aliases['react-dom/server'] = 'react-dom/server.node';
}
return {
resolve: {
alias: aliases,
},
server: {
port: 3000,
},
ssr: {
optimizeDeps: {
include: ['react-dom/server.node'],
},
},
plugins: [
tailwindcss(),
reactRouterHonoServer({ runtime: 'bun' }),
process.env.CYPRESS ? react() : reactRouter(),
tsconfigPaths(),
sentryReactRouter(
{
org: sentryConfig.org,
project: sentryConfig.project,
authToken: sentryConfig.authToken,
release: { name: sentryConfig.release },
},
config
),
],
build: {
chunkSizeWarningLimit: 1000, // Increase size limit to 1000kb
target: 'esnext', // Compiles to modern JavaScript features for latest browsers
sourcemap: sentryConfig.isSourcemapEnabled ? 'hidden' : false,
},
};
});