프로젝트 진행중 발생한 모듈 불러오기 오류
210
작성한 질문수 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
/config 에서 output-style 을 변경
0
4
0
한국어 문제
0
7
1
Node.js 관련 질문드립니다.
0
17
3
클로드 버전업 설치
0
18
2
쿠폰 문의 드립니다.
0
12
2
13강 프로젝트 생성 Next.js 설치이슈
0
13
2
Shell Command: Install 'cursor' command 진행에서 막혔습니다
0
13
2
74. 데이터 캐시 - 1 (이론) 강의 영상 누락
0
16
1
Agent team / subagent 생성시 재사용 가능 여부
0
22
2
shirimp task manager는 프로젝트 처음 시작 단계에서도 쓴는 것 과 관련해서 질문
0
14
2
MCP 서버 내용 변경
0
22
2
설치가 완료되었다고 하는데 왜 확인이 안될까요?ㅠ
0
23
3
맥에서 git이 설치되지 않아요...
0
18
2
ll 명령어 문의
0
16
2
퀴즈 생성
0
23
2
프로젝트 하위 .claude 폴더
0
22
2
클로드코드에서 yes 를 always 로 설정하려면 어떻게 해야하죠?
0
29
2
claude 계정 두개
0
20
1
쉬림프 테스크 매니저 설치
0
21
2
Codex와 Claude code 비교
0
30
1
my-style.md 만들기 미션
0
22
2
스킬, 플러그인, 마켓플레이스 관련 문의
0
34
2
클로드 코드 요금제 대신 사용량 기반 과금제를 사용하고 있습니다.
0
34
2
25강부터 소리만 나오고 화면이 안나옵니다.
0
27
1





