1

Update: I was able to solve the issue. One of the third part scripts I was including was missing a semicolon, thereby breaking the closure. When the minified version was being used, the generator didn't know where the block ended and new blocks began. The grunt build process works fine as is now, without modification.

I've got an angular app that I built with the generator-angular yeoman generator and it works wonderfully in the local "grunt serve" state. When I run "grunt build," however, the built version doesn't work properly. I'm using the standard Gruntfile that comes with the generator.

The only different between the grunt serve and the grunt build tasks are the minification, concatenation and uglification of files. You'd think it would simply concat and minify the files in the same order it loads them in the development build, but it looks like things are being loaded in a different order—throwing a app.init() is not a function error—which tells me the app module isn't loaded before that section.

Is there something that needs to be done to the default build task to fix this issue?

traviswingo
  • 315
  • 2
  • 17

1 Answers1

0

I'm not sure what the problem is, but I think that can be the minification process, there are several ways of writing a controller and some of them have problems at the time of the minification.
If the problem is the minification you could check these pages.

  1. AnularJs - A note on minification
  2. Best Practice of Minification StackOverflow
  3. Example about minifying AngularJs Controllers
Community
  • 1
  • 1
Quethzel Diaz
  • 621
  • 1
  • 11
  • 26
  • Since posting this question I've recreated a bare bones generator-angular and ran "grunt serve:dist" and found it works just fine. I have four js files in a vendor folder with the app/scripts directory that are the culprits to the loading issue. I'm also finding that my new files are not showing up in the scripts UNLESS I add them via a generator (yo angular:controller myController). – traviswingo Nov 23 '15 at 00:05