-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathvite.config.ts
More file actions
52 lines (50 loc) · 1.29 KB
/
vite.config.ts
File metadata and controls
52 lines (50 loc) · 1.29 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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import gzipPlugin from 'rollup-plugin-gzip';
/*
* Use this if we want to HMR the server, but lose global error handling/global 404
* The Express app plugin. Specify the URL base path
* for the app and the Express app object.
*/
// import server from './server/server'
// const expressServerPlugin = (path: string, expressApp) => ({
// name: 'configure-server',
// configureServer(server) {
// return () => {
// server.middlewares.use(path, expressApp);
// }
// }
// });
/*
* Vite configuration
*/
export default defineConfig({
server: {
proxy: {
'/user': 'http://localhost:3000',
'/apps': 'http://localhost:3000',
'/api': 'http://localhost:3000',
},
},
plugins: [
react(),
gzipPlugin(),
// expressServerPlugin('/', server)
],
build: {
rollupOptions: {
output: {
manualChunks: (id) => {
// group all react-realted modules into a 'react' chunk
if (id.includes('node_modules/react')) {
return 'react';
}
// group all recharts-realted modules into a 'recharts' chunk
if (id.includes('node_modules/recharts')) {
return 'recharts';
}
},
},
},
},
});