-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.js
60 lines (58 loc) · 1.35 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
54
55
56
57
58
59
60
import react from "@vitejs/plugin-react";
import { resolve } from "node:path";
import { defineConfig } from "vite";
import { env } from "node:process";
import viteImagemin from "@vheemstra/vite-plugin-imagemin";
import imageminGifSicle from "imagemin-gifsicle";
import imageminMozjpeg from "imagemin-mozjpeg";
import imageminPngQuant from "imagemin-pngquant";
import imageminSvgo from "imagemin-svgo";
import imageminWebp from "imagemin-webp";
const isDev = env.NODE_ENV === "development";
// https://vitejs.dev/config/
export default defineConfig({
base: "/react-project-7/",
plugins: [
react(),
viteImagemin({
plugins: {
jpg: imageminMozjpeg(),
png: imageminPngQuant(),
gif: imageminGifSicle(),
svg: imageminSvgo(),
},
makeWebp: {
plugins: {
jpg: imageminWebp(),
png: imageminWebp(),
},
},
}),
],
css: {
devSourcemap: true,
modules: {
generateScopedName: isDev
? "[name]_[local]__[hash:base64:5]"
: "[hash:base64:4]",
},
},
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
},
},
// 빌드 시, 청크 파일 생성 매뉴얼 구성
build: {
rollupOptions: {
output: {
manualChunks: {
react: ["react", "react-dom"],
reactRouter: ["react-router-dom"],
animations: ["framer-motion"],
extra: ["zustand", "immer", "@tanstack/react-query"],
},
},
},
},
});