How to get typescript to compile my bits


#1

I’m trying to configure my typescript compiler to include my bits. I’ve added the include value to the tsconfig.json but I’m getting an error of No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["../node_modules/@bit/**/*!(*.spec.ts)"]' and 'exclude' paths were '["test.ts","**/*.spec.ts"]'.

How can I set things up so that my components are getting included in the compilation, but my tests will be ignored and not included in the build?

`{
  "compileOnSave": false,
  "include":["node_modules/@bit/**/*!(*.spec.ts)"],

  "compilerOptions": {
    "baseUrl": "./src",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  }
}`

#2

hi,

Qballer posted an answer to your question in stackoverflow- https://stackoverflow.com/questions/53786329/how-do-i-include-node-modules-in-my-tsconfig/53800867#53800867
You can follow it there.

For the sake of other readers, I’ll paste his comment here as well.

There are a few things you should do:

  1. set the saveDependenciesAsComponents in your bit.json file. Look here
  2. When you do bit import , to bring your components, do bit import --skip-npm-install in order to avoid the component package dependencies. This will fallback to the project dependencies due to node module resolution.

For those reading out of context, OP is trying to import angular components using bitsrc.io CLI. Right now there is no tolling support using angular and bit. In order to share components they have to live in very similar angular projects, so the angular compiler will take care of compilation.