-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.mts
More file actions
49 lines (47 loc) · 1.17 KB
/
vite.config.mts
File metadata and controls
49 lines (47 loc) · 1.17 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
import reactRefresh from '@vitejs/plugin-react-refresh';
import path from 'path';
import { defineConfig } from 'vite';
function removeUseClientPlugin() {
return {
name: 'remove-use-client',
transform(code, id) {
if (id.includes('@tanstack/react-query') || id.includes('@tanstack/react-query-devtools')) {
return {
code: code.replace(/^['"]use client['"];?\s*$/m, ''),
map: null,
};
}
},
};
}
// https://vitejs.dev/config/
export default defineConfig({
optimizeDeps: {
include: ['@tanstack/react-query', '@tanstack/react-query-devtools'],
},
esbuild: {
logOverride: { 'this-is-undefined-in-esm': 'silent' },
},
server: {
port: 3002,
},
resolve: {
alias: {
'@': path.resolve(process.cwd(), './src'),
},
},
build: {
outDir: 'build',
chunkSizeWarningLimit: 3500,
// rollupOptions: {
// output: {
// manualChunks(id) {
// if (id.includes('node_modules')) {
// return id.toString().split('node_modules/')[1].split('/')[0].toString();
// }
// },
// },
// },
},
plugins: [reactRefresh(), removeUseClientPlugin()],
});