-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathvite.config.ts
49 lines (46 loc) · 1.28 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
import react from '@vitejs/plugin-react-swc';
import analyze from 'rollup-plugin-analyzer';
import type { AliasOptions } from 'vite';
import { defineConfig } from 'vitest/config';
// https://vitejs.dev/config/
export default () => {
let resolveAliases: AliasOptions = [];
if (process.env.WITH_PROFILING) {
resolveAliases = [
{ find: 'react-dom/client', replacement: 'react-dom/profiling' },
{ find: 'scheduler/tracing', replacement: 'scheduler/tracing-profiling' },
];
}
return defineConfig({
base: './',
esbuild: {
jsx: 'automatic',
sourcemap: 'inline',
},
build: {
sourcemap: 'inline',
rollupOptions: {
// @ts-expect-error analyzer types are wrong.
plugins: process.env.ANALYZE ? [analyze()] : [],
output: {
manualChunks(id) {
if (id.includes('node_modules/openchemlib/')) {
return 'openchemlib';
}
if (id.includes('node_modules')) {
return 'vendor';
}
},
},
},
minify: process.env.NO_MINIFY ? false : 'esbuild',
},
plugins: [react()],
resolve: {
alias: resolveAliases,
},
test: {
include: ['./src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
},
});
};