dannie.f
dannie.f

Reputation: 2425

In TypeScript's tsconfig file, how do I exclude 'node_modules' folder but include certain sub files

I have a tsconfig like so

{
  "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"
  ]
}

And I am using webpack to bundle my project files. Most definition files have been added using typings but certain npm modules includes their own definition files. I want to be able to add those to the typescript compilation. Otherwise I get errors like Cannot find module X

How do I include those definition files in the compilation?

Upvotes: 2

Views: 4981

Answers (1)

basarat
basarat

Reputation: 275799

certain npm modules includes their own definition files

These will get picked up (despite the exclude) if you set your module to commonjs 🌹

Upvotes: 5

Related Questions