-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
34 lines (33 loc) Β· 1.15 KB
/
vite.config.ts
File metadata and controls
34 lines (33 loc) Β· 1.15 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
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import compression from 'vite-plugin-compression';
export default defineConfig({
plugins: [react(), compression({ algorithm: 'gzip' }), compression({ algorithm: 'brotliCompress', ext: '.br' })],
build: {
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.indexOf('node_modules') !== -1) {
const module = id.split('node_modules/').pop().split('/')[0];
return `vendor-${module}`;
}
},
},
},
},
resolve: {
alias: [
{ find: '@api', replacement: '/src/api' },
{ find: '@assets', replacement: '/src/assets' },
{ find: '@components', replacement: '/src/components' },
{ find: '@constants', replacement: '/src/constants' },
{ find: '@hooks', replacement: '/src/hooks' },
{ find: '@pages', replacement: '/src/pages' },
{ find: '@stores', replacement: '/src/stores' },
{ find: '@utils', replacement: '/src/utils' },
{ find: '@styles', replacement: '/src/styles' },
{ find: '@', replacement: '/src' },
],
},
define: { global: 'window' },
});