title: Angular grunt build (from yeoman) breaks my app
body: <p>after running the build from the <code>/dist</code> folder I get:</p>
  
  <pre><code>Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.1/$injector/modulerr?p0=ourname&amp;p1=Error%3A…(http%3A%2F%2Flocalhost%3A8085%2Flib%2Fangular%2Fangular.min.js%3A32%3A462) 
  </code></pre>
  
  <p>nothing I do seems to solve this problem</p>
  
  <p>this is the grunt task flow - adapted 1 to 1 from yeoman angular-generator:</p>
  
  <pre><code>module.exports = function(grunt){
      require('load-grunt-tasks')(grunt);
      require('time-grunt')(grunt);
  
      grunt.initConfig({
          //pkg: grunt.file.readJSON('package.json'),
          yeoman: {
              // configurable paths
              app: require('./bower.json').appPath || 'app',
              dist: 'dist'
          },
          coveralls:{
          options:{
            coverage_dir:'coverage'
          }
           },
          jshint:{
              files:['app/js/**/*.js', 'Gruntfile.js'],
              options:grunt.file.readJSON('.jshintrc')
  
  
          },
          watch:{
              styles: {
                  files: ['&lt;%= yeoman.app %&gt;/css/{,*/}*.css'],
                  tasks: ['copy:css', 'autoprefixer']
              },
              livereload: {
                  options: {
                      livereload: '&lt;%= connect.options.livereload %&gt;'
                  },
                  files: [
                      '&lt;%= yeoman.app %&gt;/{,*/}*.html',
                      '.tmp/css/{,*/}*.css',
                      '{.tmp,&lt;%= yeoman.app %&gt;}/js/{,*/}*.js',
                      '&lt;%= yeoman.app %&gt;/img/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                  ]
              }
          },
          autoprefixer: {
              options: ['last 1 version'],
              dist: {
                  files: [{
                      expand: true,
                      cwd: '.tmp/styles/',
                      src: '{,*/}*.css',
                      dest: '.tmp/styles/'
                  }]
              }
          },
          connect: {
              options: {
                  port: 9000,
                  // Change this to '0.0.0.0' to access the server from outside.
                  hostname: 'localhost',
                  livereload: 35729
              },
              livereload: {
                  options: {
                      open: true,
                      base: [
                          '.tmp',
                          '&lt;%= yeoman.app %&gt;'
                      ]
                  }
              },
              test: {
                  options: {
                      port: 9001,
                      base: [
                          '.tmp',
                          'test',
                          '&lt;%= yeoman.app %&gt;'
                      ]
                  }
              },
              dist: {
                  options: {
                      base: '&lt;%= yeoman.dist %&gt;'
                  }
              }
          },
          clean: {
              dist: {
                  files: [{
                      dot: true,
                      src: [
                          '.tmp',
                          '&lt;%= yeoman.dist %&gt;/*',
                          '!&lt;%= yeoman.dist %&gt;/.git*'
                      ]
                  }]
              },
  //            server: '.tmp'
          },
              rev: {
                  dist: {
                      files: {
                          src: [
                              '&lt;%= yeoman.dist %&gt;/js/{,*/}*.js',
                              '&lt;%= yeoman.dist %&gt;/css/{,*/}*.css',
                              '&lt;%= yeoman.dist %&gt;/img/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
                              '&lt;%= yeoman.dist %&gt;/css/fonts/*'
                          ]
                      }
                  }
              },
              useminPrepare: {
                  html: '&lt;%= yeoman.app %&gt;/index.html',
                  options: {
                      dest: '&lt;%= yeoman.dist %&gt;',
                      html: {
                          steps: {'js': ['concat','ngmin']},
                          post: {}
                      }
                  }
              },
              usemin: {
                  html: ['&lt;%= yeoman.dist %&gt;/{,*/}*.html'],
                  css: ['&lt;%= yeoman.dist %&gt;/css/{,*/}*.css'],
                  options: {
                      assetsDirs: ['&lt;%= yeoman.dist %&gt;']
                  }
              },
              imagemin: {
                  dist: {
                      files: [{
                          expand: true,
                          cwd: '&lt;%= yeoman.app %&gt;/img',
                          src: '{,*/}*.{png,jpg,jpeg}',
                          dest: '&lt;%= yeoman.dist %&gt;/img'
                      }]
                  }
              },
              svgmin: {
                  dist: {
                      files: [{
                          expand: true,
                          cwd: '&lt;%= yeoman.app %&gt;/img',
                          src: '{,*/}*.svg',
                          dest: '&lt;%= yeoman.dist %&gt;/img'
                      }]
                  }
              },
              cssmin: {
                  // By default, your `index.html` &lt;!-- Usemin Block --&gt; will take care of
                  // minification. This option is pre-configured if you do not wish to use
                  // Usemin blocks.
                  // dist: {
                  //   files: {
                  //     '&lt;%= yeoman.dist %&gt;/styles/main.css': [
                  //       '.tmp/styles/{,*/}*.css',
                  //       '&lt;%= yeoman.app %&gt;/styles/{,*/}*.css'
                  //     ]
                  //   }
                  // }
              },
              htmlmin: {
                  dist: {
                      options: {
                          /*removeCommentsFromCDATA: true,
                           // https://github.com/yeoman/grunt-usemin/issues/44
                           //collapseWhituseminPrepareespace: true,
                           collapseBooleanAttributes: true,
                           removeAttributeQuotes: true,
                           removeRedundantAttributes: true,
                           useShortDoctype: true,
                           removeEmptyAttributes: true,
                           removeOptionalTags: true*/
                      },
                      files: [{
                          expand: true,
                          cwd: '&lt;%= yeoman.app %&gt;',
                          src: ['*.html', 'partials/*.html'],
                          dest: '&lt;%= yeoman.dist %&gt;'
                      }]
                  }
              },
          copy: {
              dist: {
                  files: [{
                      expand: true,
                      dot: true,
                      cwd: '&lt;%= yeoman.app %&gt;',
                      dest: '&lt;%= yeoman.dist %&gt;',
                      src: [
                          '*.{ico,png,txt}',
                          'lib/**/*',
                          'img/{,*/}*.{gif,webp}',
                          'fonts/*',
                          'languages/*'
                      ]
                  }, {
                      expand: true,
                      cwd: '.tmp/img',
                      dest: '&lt;%= yeoman.dist %&gt;/img',
                      src: [
                          'generated/*'
                      ]
                  }]
              },
              styles: {
                  expand: true,
                  cwd: '&lt;%= yeoman.app %&gt;/css',
                  dest: '.tmp/css/',
                  src: '{,*/}*.css'
              }
          },
          concurrent: {
              server: [
                  'copy:styles'
              ],
              test: [
                  'copy:styles'
              ],
              dist: [
                  'copy:styles',
                  'imagemin',
                  'svgmin',
                  'htmlmin'
              ]
          },
  //        cdnify: {
  //            dist: {
  //                html: ['&lt;%= yeoman.dist %&gt;/*.html']
  //            }
  //        },
          ngmin: {
              dist: {
                  files: [{
                      expand: true,
                      cwd: '.tmp/concat/js',
                      src: '*.js',
                      dest: '.tmp/concat/js'
                  }]
              }
          },
          uglify: {
              dist: {
                  options:{
                      compress:false,
                      mangle:false
                  },
                  files: {
                      '&lt;%= yeoman.dist %&gt;/js/scripts.js': [
                          '&lt;%= yeoman.dist %&gt;/js/scripts.js'
                      ]
                  }
              }
          },
  
  
  //        concat:{
  //            options:{
  //                seperator:';'
  //            },
  //            dist:{
  //                src :['app/js/**/*.js', 'app/lib/**/*.js'],
  //                dest :'dist/app/js/&lt;%pkg.name%&gt;.js'
  //
  //            }
  //        },
          exec:{
              instrument:{
                  cmd: function(){
                      return 'istanbul instrument app/js -o app/instrumentjs';
                  }
  
              },
              djangoUp:{
                cmd: function(){
                    var command = 'workon stokeet-api  &amp;&amp; cd ../stokeet-api/ &amp;&amp; python manage.py runserver&gt; /dev/null 2&gt;&amp;1 &amp;&amp; cd ../angular/ &amp; ';
                    return command;
                }
              },
  
              webserverUp:{
                cmd: function(){
                    var command = 'cd ../angular/ &amp;&amp; node ./scripts/web-server.js &gt; /dev/null 2&gt;&amp;1 &amp;';
                    return command;
                }
  
              }
          },
          karma:{
              unit:{
                  configFile:'config/karma.conf.js',
                  autoWatch:true,
                  browsers:['PhantomJS']
              },
              ci:{
                  configFile:'config/karma.conf.js',
                  singleRun:true,
                  autoWatch:false,
                  browsers:['Firefox','PhantomJS']
              },
              buildTest:{
                  configFile:'config/karma.conf.js',
                  singleRun:true,
                  autoWatch:false,
                  browsers:['PhantomJS']
              }
  
          }
  
  
  
      });
      grunt.registerTask('coverage',['coveralls']);
      grunt.registerTask('default',['jshint']);
      grunt.registerTask('instrument',['exec: instrument']);
  //    grunt.registerTask('concat',['concat']);
      grunt.registerTask('dev_up',['exec:djangoUp', 'exec:webserverUp']);
      grunt.registerTask('test',[
                              'clean:server',
                              'concurrent:test',
                              'autoprefixer',
                              'connect:test',
                              'karma:buildTest']),
      grunt.registerTask('build', [
                              'clean:dist',
                              'useminPrepare',
                              'concurrent:dist',
                              'autoprefixer',
                              'concat',
  
                              'copy:dist',
                              'ngmin',
                              'cssmin',
                              'uglify',
                              'rev',
                              'usemin'
      ]);
      grunt.registerTask('server', function (target) {
          if (target === 'dist') {
              return grunt.task.run(['build', 'connect:dist:keepalive']);
          }
  
          grunt.task.run([
              'clean:server',
              'concurrent:server',
              'autoprefixer',
              'connect:livereload',
              'watch'
          ]);
      });
  
  };
  </code></pre>
  
  <p>You can see I tried overriding the <code>usemin</code> default flow, but that didn't help</p>
  
  <p>I suspect this has to do with the known angular minification problem, but since ngmin is running here, and all my code (Not sure about the plugins) does respect the angular minification safe array notation I'm not sure .</p>
  
  <p>any ideas? I'll be glad for any help with this</p>