title: Angular module().factory() is not a function after concat (gulp)
body: <p>Trying to concat/uglify my <code>angular</code> app using <code>gulp</code> for the last few hours, i have stripped down whole process to simple concat, and even removed angular file from concat process to a separate <code>&lt;script&gt;</code> request in header - and still, I receive the same error:</p>
  
  <p><strong>Uncaught TypeError: angular.module(...).factory(...) is not a function</strong></p>
  
  <p>Without concat everything is fine.</p>
  
  <p>My gulp task:</p>
  
  <pre><code>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'));
  });
  </code></pre>
  
  <p>It seems that Error basicaly happends as soon as <code>.factory</code> appears in code.</p>
  
  <p>Here is the line on which it currently stops with error - it is a minified code, yet i am not minifiying it, im just concating files right now including <code>angular-animate.min</code> from which this line of code (1st one in fact).<br>
  And if I remove <code>angular-animate</code> it will just throw error on another factory that will be on the way.</p>
  
  <pre><code>(function(N,f,W){'use strict';f.module("ngAnimate",["ng"]).directive("ngAnimateChildren",function(){return function(X,r,g){g=g.ngAnimateChildren;f.isString(g)&amp;&amp;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...
  </code></pre>
  
  <p><strong>UPDATE</strong>: Oh, I was mistaken, it's NOT breaking as soon as .factory met; it breaks as soon as it meets .factory in minified part of concated file...</p>
  
  <p>Will be happy to hear any solutions/assumptions!</p>