Grunt 构建破坏了我编译的 javascript

Grunt build is breaking my compiled javascript

我有一个项目从一开始就不是我的,整个部署也不完整。我有该死的 grunt 忽略指定的覆盖 here 现在我发现当他生成具有所有依赖项的 vendor.js 时它根本不起作用。浏览器打印:

    Uncaught TypeError: Cannot read property 'Item' of undefined(anonymous function) @ vendor.js:14(anonymous function) @ vendor.js:14
vendor.js:4 Uncaught Error: [$injector:nomod] Module 'gettext' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.2.14/$injector/nomod?p0=gettext(anonymous function) @ vendor.js:4(anonymous function) @ vendor.js:4b @ vendor.js:4l.bootstrap @ vendor.js:4(anonymous function) @ scripts.js:1
VM47 vendor.js:4 Uncaught Error: [$injector:modulerr] Failed to instantiate module trepeatApp due to:
Error: [$injector:modulerr] Failed to instantiate module angularPayments due to:
Error: [$injector:nomod] Module 'angularPayments' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

当我只使用 grunt serve 任务时,它工作正常,但如果我 grunt build 这些任务中的某些东西就会中断该死的剧本

    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'usemin',
    'htmlmin',

有人可以帮助我吗?我快绝望了

[更新 - 24/08/2015] 我已经阅读了 link @RobSchmuecker 的评论并更改了 gettext 配置中的一些内容,其中一个错误已解决。

Uncaught Error: [$injector:modulerr] Failed to instantiate module trepeatApp due to:
Error: [$injector:modulerr] Failed to instantiate module angularPayments due to:
Error: [$injector:nomod] Module 'angularPayments' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.4.4/$injector/nomod?p0=angularPayments
    at http://mylocaldev.com:3000/scripts/vendor.js:4:15152
    at http://mylocaldev.com:3000/scripts/vendor.js:4:24650
    at b (http://mylocaldev.com:3000/scripts/vendor.js:4:24123)
    at http://mylocaldev.com:3000/scripts/vendor.js:4:24435
    at http://mylocaldev.com:3000/scripts/vendor.js:5:1222
    at f (http://mylocaldev.com:3000/scripts/vendor.js:4:15559)
    at n (http://mylocaldev.com:3000/scripts/vendor.js:5:1000)
    at http://mylocaldev.com:3000/scripts/vendor.js:5:1169
    at f (http://mylocaldev.com:3000/scripts/vendor.js:4:15559)
    at n (http://mylocaldev.com:3000/scripts/vendor.js:5:1000)
http://errors.angularjs.org/1.4.4/$injector/modulerr?p0=angularPayments&p1=…20n%20(http%3A%2F%2Fmylocaldev.com%3A3000%2Fscripts%2Fvendor.js%3A5%3A1000)
    at http://mylocaldev.com:3000/scripts/vendor.js:4:15152
    at http://mylocaldev.com:3000/scripts/vendor.js:5:1428
    at f (http://mylocaldev.com:3000/scripts/vendor.js:4:15559)
    at n (http://mylocaldev.com:3000/scripts/vendor.js:5:1000)
    at http://mylocaldev.com:3000/scripts/vendor.js:5:1169
    at f (http://mylocaldev.com:3000/scripts/vendor.js:4:15559)
    at n (http://mylocaldev.com:3000/scripts/vendor.js:5:1000)
    at $a (http://mylocaldev.com:3000/scripts/vendor.js:5:2690)
    at h (http://mylocaldev.com:3000/scripts/vendor.js:4:22195)
    at ga (http://mylocaldev.com:3000/scripts/vendor.js:4:22505)
http://errors.angularjs.org/1.4.4/$injector/modulerr?p0=trepeatApp&p1=Error…ga%20(http%3A%2F%2Fmylocaldev.com%3A3000%2Fscripts%2Fvendor.js%3A4%3A22505)

发现当我 运行 grunt serve 时一切正常,但是当我编译、缩小和其他一切时这个错误

Uncaught TypeError: Cannot read property 'Item' of undefined(anonymous function) @ vendor.js:14(anonymous function) @ vendor.js:14

实际上会阻止 angular 的正常运行。造成此问题的原因是需要在 bower.json 文件上覆盖 outlayer,以便 item.jsoutlayer.js 之前加载,并且由于某些未知原因,覆盖选项是不适合我。我不得不从我的 bower.json 中删除 outlayer 并在 angular.

上加载所有内容后手动将其包含在索引中

正如 jesus.jackson.sena 正确指出的那样,此错误可能是由外层引起的。但与他相反,覆盖对我来说效果很好。所以给需要的人一个参考,就是bower.json:

中正确设置override的方法
"overrides": {
  "outlayer": {
    "main": [
      "item.js",
      "outlayer.js"
    ]
  }
}

对于那些对这种行为的原因感兴趣的人: outlayer.js 具有以下初始化代码:

window.Outlayer = factory(
  window,
  window.EvEmitter,
  window.getSize,
  window.fizzyUIUtils,
  window.Outlayer.Item
);

要定义window.Outlayer.Item,首先要调用Outlayer的item.js,定义如下:

window.Outlayer = {};
window.Outlayer.Item = factory(
  window.EvEmitter,
  window.getSize
);