Categories
TypeScript Answers

How to watch and compile all TypeScript sources?

Spread the love

Sometimes, we want to watch and compile all TypeScript sources.

In this article, we’ll look at how to watch and compile all TypeScript sources.

How to watch and compile all TypeScript sources?

To watch and compile all TypeScript sources, we can make some changes to the tsconfig.json file in our TypeScript project.

For instance, we write

{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "module": "commonjs",
    "target": "ES5",
    "outDir": "ts-built",
    "rootDir": "src"
  }
}

to set the rootDir property to the path of the folder with all the files we want to compile.

Conclusion

To watch and compile all TypeScript sources, we can make some changes to the tsconfig.json file in our TypeScript project.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *