vite.config.ts
Vite์ ์ค์ ํ์ผ๋ก, ํ๋ก์ ํธ์ ๋น๋ ๋ฐ ๊ฐ๋ฐ ์๋ฒ ์ค์ ์ ์ ์ํฉ๋๋ค.
react
, svgr
, tsconfigPaths
๋ฑ)import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
server: {
port: 3000,
},
});
vite-env.d.ts
import.meta.env
์ ์ ๊ทผํ ๋ ํ์
์ค๋ฅ ๋ฐฉ์ง/// <reference types="vite/client" />
// SVG import์ฉ ์ ์ธ ์ถ๊ฐ ์์
declare module '*.svg' {
import * as React from 'react';
export const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>;
const src: string;
export default src;
}
ํญ๋ชฉ | vite.config.ts |
vite-env.d.ts |
---|---|---|
์ญํ | Vite์ ๊ตฌ์ฑ ๋ฐ ์ค์ ์ ์ | ํ์ ์คํฌ๋ฆฝํธ์ฉ ํ์ ์ ์ธ |
์์น | ํ๋ก์ ํธ ๋ฃจํธ | ๋ณดํต ๋ฃจํธ ํน์ src/ ๋ด |
์ ์ฉ ๋์ | Vite ์์ฒด ๋ฐ ํ๋ฌ๊ทธ์ธ | ํ์ ์คํฌ๋ฆฝํธ (๊ฐ๋ฐ์ ๊ฒฝํ ํฅ์) |
์์ ์์ | ํ๊ฒฝ ์ค์ ๋๋ ํ๋ฌ๊ทธ์ธ ์ถ๊ฐ ์ | ํ์ ์ค๋ฅ ๋ฐ์ ์ ๋๋ ๋ฆฌ์์ค ํ์ ์ ์ ์ |
์์ ์ฌ์ฉ | plugins , server , build ๋ฑ |
import.meta.env , SVG import ํ์
๋ฑ |