AngularJS: Grunt build does not seem to be including ui-router

Datetime:2016-08-23 02:44:48         Topic: Grunt  AngularJS          Share        Original >>
Here to See The Original Article!!!

I've tried this a few different ways now but I've installed angular-ui-router with bower using the following command:

bower install angular-ui-router

Awesome, so I can see that there is an angular-ui-router folder in my bower_components directory. I can also see it listed as a dependency in bower.json

I included the path in my project like so

<script src="bower_components/angular-ui-router/release/angular-ui-router.min.js"></script>

Running grunt serve, everything works perfectly. All of my bower components load and ui-router is routing.

Running grunt build, the build succeeds. But hosting the site, it seems that ui-router was not included. I get this all too familiar error

Module 'ui.router' is not available!

After poking around with grunt configs and a few other things, my last ditch effort was to stick a CDN script tag in my project

<script src=""></script>

However, I get the same errors as above after running grunt build.

Is there some special trick to including ui-router? All other bower components seem to be included just fine.

Solution :

Ok, I just saw that ui-router doesnt have the 'main' entry in package.json. I didnt have time to poke more. But, in bower.json file. You can add overrides entry so that it adds the file in packaging dependency.

"overrides": {

"angular-ui-router": {

"main": [





I'm not too sure, about the path. You can check the angular-ui folder to be sure. Also, dont point to the minified file, as uglify will run minification on the files.


Put your ads here, just $200 per month.