在TypeScript的tsconfig文件中,如何排除' node_modules'文件夹但包含某些子文件

时间:2016-06-02 00:11:32

标签: typescript tsconfig

我有像这样的tsconfig

{
  "compileOnSave": false,
  "compilerOptions": {
    "module": "es2015",
    "target": "es2015",
    "sourceMap": true,
    "jsx": "react",
    "allowSyntheticDefaultImports": true,
    "noImplicitAny": false,
    "watch": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowJs": true,
    "suppressOutputPathCheck": true
  },
  "exclude": [
    "dist",
    "node_modules",
    "bower_components",
    "typings/globals",
    "typings/modules"
  ]
}

我正在使用webpack捆绑我的项目文件。大多数定义文件都是使用typings添加的,但某些npm模块包含自己的定义文件。我希望能够将这些添加到打字稿编译中。否则我会收到Cannot find module X

之类的错误

如何在编辑中包含这些定义文件?

1 个答案:

答案 0 :(得分:2)

  

某些npm模块包含自己的定义文件

如果您将exclude设置为module

,这些内容将被提取(尽管commonjs
相关问题