1

하여 문제

enter image description here은 VS 코드 구문 검사

  • NPM 모듈을 가져올 때, VS 코드 NPM 모듈에 대한 수입 정보를 표시하지 해결되지 않습니다. [TS] Cannot find module 'lodash'/'react'/'etc'.
  • TypeScript로 작성된 NPM 모듈 (또는 package.jsontypings 속성이있는 모듈)을 가져 오는 경우이 문제가 표시되지 않습니다.
  • WebPack은 여전히 ​​문제없이 컴파일되므로 VS 코드 또는 입력 도구에서 문제가된다고 생각합니다.

설정

나는 tsc 1.8 아침을 실행했다. 나중에 tsc 2.0.0으로 업그레이드되었습니다.

VS 코드 1.4.0 6276dcb0ae497766056b4c09ea75be1d76a8b679

노드 5.10.0

tsc -v : === "버전 2.0.0"

tsconfig.json :

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "jsx": "react", 
    "experimentalDecorators": true, 
    "noImplicitAny": false, 
    "noFallthroughCasesInSwitch": true, 
    "forceConsistentCasingInFileNames": true, 
    "noUnusedLocals": true, 
    "strictNullChecks": true 
    }, 
    "exclude": [ 
    "node_modules" 
    ], 
    "compileOnSave": false, 
    "buildOnSave": false 
} 

전체 프로젝트 소스 코드 here. 면책 조항 : 상당히 큰 코드베이스입니다.

{ 
    "typescript.tsdk": "node_modules/typescript/lib", 
} 
:

답변

1

나는 다음과 같은 /.vscode/settings.json에 추가하여 문제를 해결할 수 있었다