-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
53 lines (51 loc) · 1.5 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
44
45
46
47
48
49
50
51
52
53
import viteImagemin from '@vheemstra/vite-plugin-imagemin';
import react from '@vitejs/plugin-react-swc';
// The minifiers you want to use:
import imageminWebp from 'imagemin-webp';
import { fileURLToPath, URL } from 'node:url';
// import bundleAnalyzer from 'rollup-plugin-bundle-analyzer';
import { defineConfig, loadEnv } from 'vite';
import checker from 'vite-plugin-checker';
import vsharp from 'vite-plugin-vsharp';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const _env = loadEnv(mode, process.cwd());
return {
plugins: [
react(),
// bundleAnalyzer({
// analyzerMode: 'server',
// }),
checker({
eslint: {
// for example, lint .ts and .tsx
lintCommand: 'eslint "./src/**/*.{js,jsx}"',
},
}),
vsharp,
viteImagemin({
plugins: {
jpg: imageminWebp(),
},
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
proxy: {
'/api': _env.VITE_API_URL,
},
},
build: {
rollupOptions: {
output: {
chunkFileNames: '[hash].chunk.js',
assetFileNames: '[hash].chunk.[ext]',
},
},
},
};
});