Vite React 프로젝트 path alias 설정하기
·
Frontend/전체
Vite를 이용해 React와 TypeScript를 기반으로 한 프로젝트 환경에서 path alias 설정하는 방법 🔶 vite-tsconfig-paths 설치 & 플러그인 추가yarn add -D vite-tsconfig-paths vite.config.ts 파일에 tsconfigPaths 플러그인 추가하기import { defineConfig } from "vite";import react from "@vitejs/plugin-react";import tsconfigPaths from "vite-tsconfig-paths";// https://vitejs.dev/config/export default defineConfig({ plugins: [react(), tsconfigPaths()],});..
CRA 프로젝트 Setting 명령어
·
Frontend/React
Creact React App 로 리액트 프로젝트 시작하기  Create React AppSet up a modern web app by running one command.create-react-app.dev 📌 설치 명령어// yarn 사용yarn create react-app [프로젝트명]// npx 사용npx create-react-app [프로젝트명]// 현재 디렉토리에 설치npx create-react-app . ⭐️ 타입스크립트 사용시yarn create-react-app [프로젝트명] --template typescriptnpx create-react-app [프로젝트명] --template typescript
react에서 alias가 상대경로로 지정 될 경우
·
Frontend/React
분명 tsconfig.paths.json에 alias를 설정했는데경로가 상대경로로 잡힌다. "typescript.preferences.importModuleSpecifier": "relative",vscode setting.json에 저 값이 relative로 되어있어서 그랬다. "typescript.preferences.importModuleSpecifier": "non-relative",non-relative로 바꿔준다. settings에서 바꿔줘도 된다.