Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building angular app with grunt, app fails to load

I have generated an angular project with yeomon (yo angular). I did some coding and tested if I could build the project (with grunt) properly. Result came out in the dist folder and it worked perfectly. Now I've coded some more (about 1000 rows) and I once again built the project. This time the browser shows nothing. No error in console. Index.html is correct and the minified js-files also seems ok.

I've added a proxy in Gruntfile.js otherwise I don't think I've done anything with it.

Any idea what can be the cause of this? How do I debug this most efficiently? Only way I can think of is to deactive everything and then acitvate module, build project, activate one more and so on. Will take a lot of time.

Update I've narrowed it down. I have a few resolves. If I remove them, then the view loads. I'm using ui-router. Can this be to any more help to resolove the issue?

.state('app', {
        url: '/app',
        resolve: {
          //medias: ['MultiProductsLoader', function(ProductsLoader) {
          //  return new ProductsLoader();
          //}]
        },
        views: {
          'inputView': {
            templateUrl: 'views/input.html',
            controller: 'AppCtrl'
          }
        }

Update2 My question was a bit unclear. The app worked perfectly when the project was in "develop mode", unminified. But when I built/minified the project, the app failed to laod without any error message. Se answer below for the solution.

like image 290
Joe Avatar asked Jan 06 '14 13:01

Joe


1 Answers

Solved!

I added this to the uglify options in Gruntfile.js

  options: {
    report: 'min',
    mangle: false
  }

You can read more about it here were I found the answear: Angular.module minification bug

like image 89
Joe Avatar answered Nov 09 '22 10:11

Joe