-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
49 lines (46 loc) · 1.26 KB
/
vite.config.js
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
import { loadEnv } from 'vite';
import { defineConfig } from 'vitest/config';
import { sentryVitePlugin } from '@sentry/vite-plugin';
import { hmrPatch } from './src/utility';
import react from '@vitejs/plugin-react-swc';
import jsconfigPaths from 'vite-jsconfig-paths';
import eslint from 'vite-plugin-eslint';
import PackageJSON from './package.json';
const config = defineConfig(args => {
const { mode } = args;
const { name, version } = PackageJSON;
const env = { ...process.env, ...loadEnv(mode, process.cwd()) };
const sentryConfig = {
authToken: env.VITE_SENTRY_AUTH_TOKEN,
org: env.VITE_SENTRY_ORG,
project: env.VITE_SENTRY_PROJECT,
release: `${name}@${version}`,
include: './dist',
};
return {
define: { 'process.env': env },
build: { chunkSizeWarningLimit: 1600, sourcemap: true },
server: {
port: 3000,
proxy: {
[env.VITE_API_V1]: {
target: 'http://localhost:9999',
changeOrigin: true,
},
},
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: [ './tests/setupTests.jsx' ],
},
plugins: [
react(),
jsconfigPaths(),
eslint(),
hmrPatch(),
sentryVitePlugin(sentryConfig),
],
};
});
export default config;