【发布时间】:2015-12-29 21:43:14
【问题描述】:
在过去的几个小时里,我尝试使用 gulp 连接/丑化我的 angular 应用程序,我已将整个过程简化为简单的 concat,甚至将 angular 文件从 concat 过程中删除为标头中的单独 <script> 请求- 我仍然收到同样的错误:
未捕获的 TypeError:angular.module(...).factory(...) 不是函数
没有 concat 一切都很好。
我的吞咽任务:
gulp.task('JS', function() {
gulp.src(['!_dependencies/angular.min.js', '_dependencies/jquery.min.js', '_dependencies/moment.min.js', 'Alpha/_lilhelpers.js', 'Alpha/routes.js' , '!trainerreg.js', '**/*.js'], {cwd: './public/scripts'})
.pipe(concat('concat.js'))
.pipe(gulp.dest('./public/min'));
});
似乎只要.factory 出现在代码中,就会发生错误。
这是它当前因错误而停止的行 - 它是一个缩小的代码,但我并没有缩小它,我现在只是连接文件,包括 angular-animate.min 这行代码(实际上是第一个) .
如果我删除angular-animate,它只会在另一个即将生产的工厂上抛出错误。
(function(N,f,W){'use strict';f.module("ngAnimate",["ng"]).directive("ngAnimateChildren",function(){return function(X,r,g){g=g.ngAnimateChildren;f.isString(g)&&0===g.length?r.data("$$ngAnimateChildren",!0):X.$watch(g,function(f){r.data("$$ngAnimateChildren",!!f)})}}).factory("$$animateReflow",["$$rAF","$document",function(f,r){var g=r[0].body;return function(r){return f(function(){r(g.offsetWidth)})}}]).config...
更新:哦,我弄错了,.factory 并没有立即中断;一旦在连接文件的缩小部分中遇到 .factory,它就会中断...
很高兴听到任何解决方案/假设!
【问题讨论】:
标签: angularjs gulp typeerror gulp-concat