【问题标题】:TypeScript Compiler looking at external directory for node_modulesTypeScript 编译器查看 node_modules 的外部目录
【发布时间】:2017-07-15 20:52:11
【问题描述】:

我有一个 angular 2 项目,它位于一个目录中: /c/users/batcave/first_project

在那个目录中,我有我的 app 文件夹、index.html、systemjs.config.js ..etc 和 node_modules 文件夹,但只有 @types 和 typescript。这意味着我的 @angular 和其他依赖项位于另一个目录中:/c/users/dep/node_modules

我已经更新了我的 systemjs.config.js 文件以在运行时查看这个不同的目录,但我的问题是编译。如何告诉 tsc 不要查看当前所在的 node_modules 文件夹,而是查看指定的外部目录:/c/users/dep/node_modules

我尝试在 tsconfig.json 中设置 baseUrl 设置,但没有成功。由于 tsconfig 位于 /c/users/batcave/first_project 中,我尝试将外部节点模块的相对路径设置为 ../../dep/

【问题讨论】:

    标签: angularjs typescript npm node-modules tsc


    【解决方案1】:

    我没有这样的设置。不过你需要的大概是include:

    // tsconfig.json
    {
      "include": [
        "/c/users/dep/node_moodules"
      ]
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-16
      • 1970-01-01
      • 1970-01-01
      • 2015-06-21
      • 2017-12-23
      • 2022-11-21
      • 2017-01-02
      • 1970-01-01
      相关资源
      最近更新 更多