-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
43 lines (42 loc) · 1.04 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
// vite.config.js
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
base:'/',
build: {
outDir: 'dist',
assetsDir: 'assets',
emptyOutDir: true,
manifest: true,
rollupOptions: {
output: {
manualChunks: {
vendor: ['react', 'react-dom', 'react-router-dom'],
},
assetFileNames: (assetInfo) => {
let extType = assetInfo.name.split('.').at(1);
if (/png|jpe?g|svg|gif|tiff|bmp|ico/i.test(extType)) {
extType = 'img';
}
return `assets/${extType}/[name]-[hash][extname]`;
},
chunkFileNames: 'assets/js/[name]-[hash].js',
entryFileNames: 'assets/js/[name]-[hash].js',
},
},
},
server: {
port: 5173,
strictPort: true,
cors: true,
historyApiFallback: true,
proxy: {
'/api': {
target: 'api.pilo.life',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
}
});