FRONTENDSCHOOL6 / escape12

ํ”„๋ก ํŠธ์—”๋“œ์Šค์ฟจ 6๊ธฐ '์ด๊ฒŒ๋ฌด์Šจ12์ด์•ผ'์กฐ
1 stars 3 forks source link

๐Ÿ”ง์ด๋ฏธ์ง€ ์ตœ์ ํ™” ์„ค์น˜ #8

Closed KIMGEUNDU closed 1 year ago

KIMGEUNDU commented 1 year ago

์ด๋ฏธ์ง€์ตœ์ ํ™” ๋ฐฉ๋ฒ•

Vite ์„ฑ๋Šฅ ์ตœ์ ํ™” ๊ตฌ์„ฑ (์ฐธ๊ณ ) ํ† ๊ธ€ ํ™•์ธํ•ด์„œ ์„ค์น˜ํ•ด์•ผํ•จ main ๋ธŒ๋žœ์น˜์—์„œ ์„ค์น˜ ํ›„ ํŒ€์›๋“ค์€ pull๋กœ ๋‹น๊ธฐ๊ธฐ

vite.config.js ๋ณ€๊ฒฝ

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";
import { splitVendorChunkPlugin } from "vite";

const isDev = env.NODE_ENV === "development";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    react(),
    splitVendorChunkPlugin(),
    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", "gsap"],
        },
      },
    },
  },
});