在gulp / typescript生产构建中禁用AngularJS调试数据

Disabling AngularJS debug data in a gulp / typescript production build

本文关键字:AngularJS 调试 数据 构建 gulp typescript      更新时间:2023-09-26

禁用gulp生产构建中的调试数据的最佳方法是什么?文档中禁用调试数据的方法如下:

myApp.config(['$compileProvider', function ($compileProvider) {
  $compileProvider.debugInfoEnabled(false);
}]);

我使用gulp- Typescript来构建应用程序。由于Typescript没有条件编译,我不知道如何在不更改代码的情况下将gulp生产构建中的参数从true设置为false。

我能想到的唯一解决方案是有条件地将debug.tsrelease.ts添加到gulp-typescriptgulp.src中。你知道更好的解决办法吗?

您可以使用gulp-ng-constant进行应用程序配置。这里有一个很好的实际例子。好的是constant s在config阶段是可用的,它适合您的情况。

但是有条件地添加配置文件也是合适的方式。