抑制生产构建的控制台输出

Suppress console output for production build

我需要在生产模式下保持控制台输出干净,但我需要开发日志。 哪些编译器选项或 tsc 的 cli 选项可以帮助我?

P.S。我只使用 tsc --build 在生产模式下构建

TypeScript 编译器无法做到这一点。根据 Ryan Cavanaugh(TypeScript 团队的开发负责人)的说法:

Lots of tools available that don't need a type system or complex downleveling to accomplish this; we're not trying to be a Swiss Army Knife

Source

您最好的选择是使用其他工具来完成此任务。