-
Notifications
You must be signed in to change notification settings - Fork 441
/
Copy pathvite.config.ts
84 lines (77 loc) · 1.97 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { reactRouter } from '@react-router/dev/vite'
import {
type SentryReactRouterBuildOptions,
sentryReactRouter,
} from '@sentry/react-router'
import tailwindcss from '@tailwindcss/vite'
import { defineConfig } from 'vite'
import { envOnlyMacros } from 'vite-env-only'
import { iconsSpritesheet } from 'vite-plugin-icons-spritesheet'
const MODE = process.env.NODE_ENV
export default defineConfig((config) => ({
build: {
target: 'es2022',
cssMinify: MODE === 'production',
rollupOptions: {
external: [/node:.*/, 'fsevents'],
},
assetsInlineLimit: (source: string) => {
if (
source.endsWith('favicon.svg') ||
source.endsWith('apple-touch-icon.png')
) {
return false
}
},
sourcemap: true,
},
server: {
watch: {
ignored: ['**/playwright-report/**'],
},
},
sentryConfig,
plugins: [
envOnlyMacros(),
tailwindcss(),
iconsSpritesheet({
inputDir: './other/svg-icons',
outputDir: './app/components/ui/icons',
fileName: 'sprite.svg',
withTypes: true,
iconNameTransformer: (name) => name,
}),
// it would be really nice to have this enabled in tests, but we'll have to
// wait until https://github.com/remix-run/remix/issues/9871 is fixed
MODE === 'test' ? null : reactRouter(),
MODE === 'production' && process.env.SENTRY_AUTH_TOKEN
? sentryReactRouter(sentryConfig, config)
: null,
],
test: {
include: ['./app/**/*.test.{ts,tsx}'],
setupFiles: ['./tests/setup/setup-test-env.ts'],
globalSetup: ['./tests/setup/global-setup.ts'],
restoreMocks: true,
coverage: {
include: ['app/**/*.{ts,tsx}'],
all: true,
},
},
}))
const sentryConfig: SentryReactRouterBuildOptions = {
authToken: process.env.SENTRY_AUTH_TOKEN,
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
unstable_sentryVitePluginOptions: {
release: {
name: process.env.COMMIT_SHA,
setCommits: {
auto: true,
},
},
sourcemaps: {
filesToDeleteAfterUpload: ['./build/**/*.map', '.server-build/**/*.map'],
},
},
}