A long-awaited feature is smart incremental builds for TypeScript projects. In 3.0 you can use the --build
flag with tsc
. This is effectively a new entry point for tsc
that behaves more like a build orchestrator than a simple compiler.
Running tsc --build
(tsc -b
for short) will do the following:
- Find all referenced projects
- Detect if they are up-to-date
- Build out-of-date projects in the correct order
You can provide tsc -b
with multiple config file paths (e.g. tsc -b src test
). Just like tsc -p
, specifying the config file name itself is unnecessary if it’s named tsconfig.json
.
> tsc -b # Use the tsconfig.json in the current directory
> tsc -b src # Use src/tsconfig.json
> tsc -b foo/prd.tsconfig.json bar # Use foo/prd.tsconfig.json and bar/tsconfig.json
Don’t worry about ordering the files you pass on the commandline - tsc
will re-order them if needed so that dependencies are always built first.
There are also some flags specific to tsc -b
:
--verbose
: Prints out verbose logging to explain what’s going on (may be combined with any other flag)--dry
: Shows what would be done but doesn’t actually build anything--clean
: Deletes the outputs of the specified projects (may be combined with--dry
)--force
: Act as if all projects are out of date--watch
: Watch mode (may not be combined with any flag except--verbose
)
标签:Typescript,--,tsc,json,Build,tsconfig,projects,build From: https://www.cnblogs.com/Answer1215/p/18395487