【问题标题】:Cannot "step into" or see definition/docs for required modules in app.ts无法“进入”或查看 app.ts 中所需模块的定义/文档
【发布时间】:2017-08-12 18:29:54
【问题描述】:

我有一个 Node.js Bot Builder 项目,其中包含 TypeScript 中的主要应用程序代码,即 app.ts。虽然我在转译的 app.js 中获得了代码完成并进入了我需要的模块代码,例如“botbuilder”,但我无法在 app.ts 中这样做。

我尝试在 tsconfig.json 中包含路径,但似乎没有帮助:

"compilerOptions": {
  "emitDecoratorMetadata": true,
  "experimentalDecorators": true,
  "moduleResolution": "node",
  "module": "commonjs",
  "target": "es5",
  "noImplicitAny": false,
  "strictNullChecks": true,
  "inlineSourceMap": true,
  "inlineSources": true,
  "baseUrl": ".",
  "paths": {
    "botbuilder": ["node_modules/botbuilder/lib/"]
  }
}

【问题讨论】:

  • 您的导入语句是什么样的? import * as botbuilder from "botbuilder"; 应该可以在您的 TypeScript 文件中使用。

标签: node.js typescript intellij-idea visual-studio-code botframework


【解决方案1】:

使用您的 tsconfig.json 为我工作:

``` 从“botbuilder”导入*作为构建器; 导入 * as restify from 'restify';

var server = restify.createServer(); //这里断点 ```

一旦断点被​​命中,Step Into 就会正确地进入 /node_modules/restify/lib/index.js:

注意Do not step into library scripts必须在Settings | Build, Execution, Deployment | Debugger | Stepping中关闭

【讨论】:

    猜你喜欢
    • 2021-06-13
    • 2017-05-17
    • 1970-01-01
    • 1970-01-01
    • 2016-09-16
    • 1970-01-01
    • 1970-01-01
    • 2017-04-02
    • 1970-01-01
    相关资源
    最近更新 更多