- Learn React with TypeScript 3
- Carl Rippon
- 310字
- 2021-06-10 19:16:44
Build mode
The TypeScript 3 compiler includes the ability to perform smart incremental builds using the --build flag. Let's give this a try in our example multiple project solution:
- First, let's go to the root of the solution, open the terminal, and enter the following:
tsc --build ProjectA --verbose
The --verbose flag tells the compiler to tell us the details of what it's doing. The messages confirm to us that it has picked up the Shared project as well as ProjectA:
Projects in this build:
* Shared/tsconfig.json
* ProjectA/tsconfig.json
The compiler then checks each project to see if it's up to date. If the project is up to date, we get something like the following:
Project 'Shared/tsconfig.json' is up to date because newest input 'Shared/src/utils.ts' is older than oldest output 'Shared/dist/utils.js'
- Let's make a change in the utils.ts file in the Shared project by adding a space somewhere, removing it, and then saving the file.
- Let's build ProjectA again:
tsc --build ProjectA --verbose
As expected, we get a message to indicate that the Shared project is out of date and will be rebuilt:
Project 'Shared/tsconfig.json' is out of date because oldest
output 'Shared/dist/utils.js' is older than newest input 'Shared/src/utils.ts
Building project '.../Shared/tsconfig.json'
- If we want to force a rebuild, even if projects are up to date, we can use the --force flag. Let's give this a try:
tsc --build ProjectA --force --verbose
When we do this, the compiler will still check whether projects are up to date (and tell us), but then it goes on to build each project.
So, in addition to great multiple-project support, we can speed up solution builds using the --build flag. As the solution grows over time, this becomes increasingly valuable. If ever we want to force a rebuild of a project, we can use the --force flag along with --build.
- Java EE 6 企業(yè)級(jí)應(yīng)用開(kāi)發(fā)教程
- Learning Real-time Processing with Spark Streaming
- Mastering RabbitMQ
- Visual Studio 2012 Cookbook
- 自制編譯器
- Mastering Objectoriented Python
- Vue.js快速入門(mén)與深入實(shí)戰(zhàn)
- OpenNI Cookbook
- 算法精粹:經(jīng)典計(jì)算機(jī)科學(xué)問(wèn)題的Python實(shí)現(xiàn)
- Cassandra Data Modeling and Analysis
- Learning Neo4j 3.x(Second Edition)
- SQL Server 2012數(shù)據(jù)庫(kù)管理與開(kāi)發(fā)項(xiàng)目教程
- Go并發(fā)編程實(shí)戰(zhàn)
- Learning Raspbian
- C/C++程序員面試指南