-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
109 lines (107 loc) · 2.79 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/// <reference types="vite/client" />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import million from 'million/compiler';
import compression from 'vite-plugin-compression';
import webfontDownload from 'vite-plugin-webfont-dl';
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';
import { createHtmlPlugin } from 'vite-plugin-html';
import removeConsole from 'vite-plugin-remove-console';
import path from 'path';
export default defineConfig({
plugins: [
million.vite({ auto: true }),
react(),
webfontDownload(
[
'https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;700&display=swap',
],
{
injectAsStyleTag: true,
minifyCss: true,
async: true,
cache: true,
proxy: false,
},
),
removeConsole(),
createHtmlPlugin({ minify: true }),
compression({
algorithm: 'brotliCompress',
ext: '.br',
}),
ViteImageOptimizer({
test: /\.(jpg|png|webp|svg)$/i,
exclude: undefined,
include: undefined,
includePublic: true,
logStats: true,
svg: {
multipass: true,
plugins: [
{
name: 'preset-default',
params: {
overrides: {
cleanupNumericValues: false,
removeViewBox: false,
},
cleanupIDs: {
minify: false,
remove: false,
},
convertPathData: false,
},
},
'sortAttrs',
{
name: 'addAttributesToSVGElement',
params: {
attributes: [{ xmlns: 'http://www.w3.org/2000/svg' }],
},
},
],
},
png: {
quality: 100,
},
jpg: {
quality: 100,
},
webp: {
lossless: true,
},
}),
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'@assets': path.resolve(__dirname, 'src/assets'),
'@components': path.resolve(__dirname, 'src/components'),
'@contexts': path.resolve(__dirname, 'src/contexts'),
'@store': path.resolve(__dirname, 'src/store'),
'@hooks': path.resolve(__dirname, 'src/hooks'),
'@services': path.resolve(__dirname, 'src/services'),
'@pages': path.resolve(__dirname, 'src/pages'),
'@utils': path.resolve(__dirname, 'src/utils'),
},
},
server: {
port: 1010,
},
esbuild: {
drop: ['console', 'debugger'],
},
build: {
outDir: './dist',
chunkSizeWarningLimit: 1500,
rollupOptions: {
output: {
manualChunks: (id) => {
// if (id.includes('commonjsHelpers')) return 'commonjsHelpers';
if (id.includes('node_modules')) return 'vendor';
},
},
},
},
});