- 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.
- GraphQL學習指南
- Java從入門到精通(第4版)
- C語言程序設計
- Julia高性能科學計算(第2版)
- jQuery炫酷應用實例集錦
- ASP.NET開發寶典
- 3ds Max 2018從入門到精通
- Mastering Python
- 計算機程序的構造和解釋(JavaScript版)
- Android熱門應用開發詳解
- 開源網絡地圖可視化:基于Leaflet的在線地圖開發
- A/B 測試:創新始于試驗
- Mastering MeteorJS Application Development
- Instant PhoneGap
- Test-Driven iOS Development with Swift 4(Third Edition)