프로젝트 진행중 발생한 모듈 불러오기 오류
216
작성한 질문수 1
안녕하세요 프로젝트를 진행하다 모듈 불러오기 관련 오류가 발생하여 질문 남겨봅니다.
문제상황
> 모듈 불러오기중 not found react + typescript + yarn berry를 사용했고 zero install과 pnp를 사용해 모듈들을 캐싱했습니다. 이 과정에서 모듈들을 import 할때아래와 같은 오류가 발생합니다.
예시
// main.tsx
import * as ReactDOM from "react-dom/client"; // Cannot find module 'react-dom/client' or its corresponding type declarations
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; // Cannot find module '@tanstack/react-query' or its corresponding type declarations.
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; // Cannot find module '@tanstack/react-query-devtools' or its corresponding type declarations.
import { BrowserRouter } from "react-router-dom"; // Cannot find module 'react-router-dom' or its corresponding type declarations
import App from "./App";
import { GlobalStyle } from "./themes/globalStyle";
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: true,
refetchOnMount: true,
staleTime: 60_000,
retry: 2,
},
},
});
ReactDOM.createRoot(document.getElementById("root")!).render(
<QueryClientProvider client={queryClient}> // Cannot find module 'react/jsx-runtime' or its corresponding type declarations.
<BrowserRouter>
<ReactQueryDevtools />
<App />
<GlobalStyle />
</BrowserRouter>
</QueryClientProvider>
);기대효과
> 모든 모듈들이 정상적으로 불러와짐
참고자료
// package.json
{
"name": "fe",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@tanstack/react-query": "^5.59.0",
"@types/react-router-dom": "^5.3.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.26.2",
"styled-components": "^6.1.13",
"zustand": "^5.0.0-rc.2"
},
"devDependencies": {
"@eslint/js": "^9.11.1",
"@tanstack/react-query-devtools": "^5.59.0",
"@types/node": "^22.7.4",
"@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0",
"@types/styled-components": "^5.1.34",
"@vitejs/plugin-react-swc": "^3.5.0",
"eslint": "^9.11.1",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.12",
"globals": "^15.9.0",
"typescript": "^5.6.2",
"typescript-eslint": "^8.7.0",
"vite": "^5.4.8"
},
"packageManager": "yarn@4.5.0"
}// tsconfig.json
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "node",
"allowImportingTsExtensions": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src", "**/*.ts", "**/*.tsx"]
}
타입스크립트 버전 : 5.6.2
vsc 버전 : September 2024 (version 1.94)
시도한 것
> vsc 재시작, 재설치
답변 0
슬슬 따라하기가 힘들어진다.
0
12
1
[문의] 섹션 7 미션 진행 중...
0
13
1
기본 브랜치의 이름이 master에요.
0
15
1
관리자 페이지 질문
0
12
1
plans 생성이 안됩니다.
0
17
2
더빙에 어떤 ai가 쓰였는지 궁금합니다.
0
16
0
보안 적용에 대한 강의가 있을까요?
0
12
1
Auto-memory 기능
0
15
1
64강 context 7 관련 질문
0
14
1
Auto-memory 기능
0
16
0
55강 7분56초
0
13
0
55강 git 초기화 관련 질문이요
0
12
1
클로드 코드에 붙여넣기후 편집 관련 질문입니다!
0
17
1
존재하지 않는 일기 url입력 시 alert이 두 번 떠요
0
23
1
윈 터미널의 클로드와 에디터의 터미널의 클로드에 관한 질문
0
16
1
output-styles 명령어 없어 지지 않았나요?
0
20
1
[MISSION 7] 프로필 웹 Github 링크 제출하기 관련..
0
28
0
커서 클로드 코드 검색창 검색 시
0
20
1
/init 초기화 이유
0
28
2
Git commit 관련 질문
0
23
2
Powershell은 시스템관리자가 앱을 차단
1
26
2
/plan open 관련 질문 39강 5분 36초
0
25
2
39강 루트 용어 질문
0
23
2
디렉토리 위치 바탕화면
0
33
2





