Grunt.js连接并打破angular.js项目?

我有一个Angular.js项目。 我可以使用grunt服务,它运行完美。 但是,当我将其构build到dist文件夹时,它将不会运行,并且控制台会引发错误:

Uncaught Error: [$injector:modulerr] Failed to instantiate module designSystemApp due to: Error: [$injector:unpr] Unknown provider: a http://errors.angularjs.org/1.2.6/$injector/unpr?p0=a at http://0.0.0.0:9000/scripts/vendor.js:3:30474 at ...<omitted>...2) 

构build发生没有错误,文件(Bower组件)连接到vendor.js。 但浏览器出错了。 错误是为了最小化文件,所以debugging错误有点困难。 任何人见过这个?

我的grunt文件在这里: https : //gist.github.com/smlombardi/7fa15161b60c2f63f416

我有点失落 谢谢。

你可以用各种方式处理你的dependency injection。 例如:

 function injectableFunc($someService, someOtherDependency) {...} 

要么

 ['$someService', 'someOtherDependency', function (thisWillBeSomeService, nameDoesNotMatter) {...}] 

主要区别在于第二种forms“生存”缩小,因为依赖关系是由数组的第一个string项标识的(而string不会被缩小)。
第二种forms将在缩小后中断,因为variables名称(用于识别注射剂)已更改。

如果您的工作stream程包含缩小(它应该),您可以:

  1. 使用第二种forms
  2. 使用ngmin缩小,可以处理第一个窗体,而不会中断应用程序。