问题
- 导入 NPM 模块时,VS Code 无法显示有关 NPM 模块的导入信息。
[TS] Cannot find module 'lodash'/'react'/'etc'.
- 导入用 TypeScript 编写的 NPM 模块(或其中包含
typings
属性的 NPM 模块package.json
)时,我没有看到这个问题。 - WebPack 仍然可以毫无问题地编译,这让我相信这是 VS Code 或 Typings 工具的问题。
设置
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
}
完整的项目源代码在这里。免责声明:这是一个相当大的代码库。