inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

프로젝트 진행중 발생한 모듈 불러오기 오류

232

식충나무

작성한 질문수 1

0

안녕하세요 프로젝트를 진행하다 모듈 불러오기 관련 오류가 발생하여 질문 남겨봅니다.

문제상황

> 모듈 불러오기중 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 재시작, 재설치

yarn react typescript

답변 0

강의자료 url 접속이 안됩니다.

0

3

1

31강 학습자료에 프롬프트가 엉뚱한것이 있어요

0

7

0

plan mode를 진행하는것에 있어서

0

7

1

클로드 코드 설치 관련

0

15

1

스타터킷 중요도에 대한 질문입니다.

0

15

1

mission12-01 guide.md파일 누락

0

14

1

슬라이드 오타

0

22

0

강의 소스 코드는 어디서 볼수 있나여?

1

31

1

전체적인 개발에 대해 문의드립니다.

1

39

1

챌린지 시작일 문의

0

39

0

17강 강의에 목데이터 첨부파일이 없습니다.

2

40

2

줄바꿈 시 \ 필수인가요?

0

49

2

2605 이후 최신 클로드코드 강의 추가 부탁드립니다.

0

48

2

커리큘럼 문서 제공받을 수 있을까요?

0

44

1

ThemeProvider를 이용해서 NextThemeProvider를 따로 생성하여 Layout.tsx에 적용하는 이유는 뭘까요?

0

31

1

인덱스드 엑세스타입 실무질문

0

25

2

mission 09-01 을 수행할 수 없어요

0

33

1

outputStyle 설정하는데 어디서 문제일까요?

0

30

3

test.txt파일 삭제시 rm명령어이니 클로드의 질문이 있어야 한다고 하셨는데

0

23

2

검은화면

0

32

3

강의교환링크안열려요.....

0

34

2

영상재생에러 [확인부탁드려요!!!]

0

26

2

클로드 채팅에서 코드로 넘어가기

0

42

2

Context API vs Zustand 그리고 Auth

0

39

2