在过去的几个小时里,我试图 concat/uglify 我的angular
应用程序gulp
,我已经将整个过程简化为简单的 concat,甚至将 angular 文件从 concat 进程删除到<script>
标头中的单独请求 - 但我仍然收到相同的错误:
未捕获的类型错误: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 就会中断...
很高兴听到任何解决方案/假设!