2

I am seeing this error in AngularJS

enter image description here

Wierdly, it only occurs when I deploy it in Azure Cloud.

In my local instance - it doesn't occur.

Any ideas?

Update: this is the actual website

login using this sample account

sample@test.com / 1Sample

UPDATE! I suspect that this script causes the error

enter image description here

I dont know why the select.js fails to minify

https://github.com/angular-ui/ui-select

I actually installed the ui-select via bower command line - and then just include it manualy in the bundleconfig. Is this the issue here?

UPDATE - I pinpoint the error and seems like the config of the ui-select is the culprit

enter image description here

Any idea on this?

Linc Abela
  • 797
  • 2
  • 12
  • 26

1 Answers1

2

The issue is because it's getting a 404 error for this resource:

http://tradies-prototype.cloudapp.net/bundles/angular-animate.min.js.map

Make sure to include the .map files in your bundle.

EDIT:

As @CaspNZ pointed out in the comments bellow, if you have a look at this:

http://tradies-prototype.cloudapp.net/bundles/angular

you will see that you are getting this error:

/* Minification failed. Returning unminified contents.
(248,386-393): run-time error JS1019: Can't have 'break' outside of loop: break a
 */

Which means that there is something wrong with your ASP.Net MVC Bundling. It could be many things, but make sure that you are aware of this, so that your angularJs code can be minified properly.

EDIT 2

Also, have a look at this: Mvc4 bundling, minification and AngularJS services and this: http://www.codeproject.com/Tips/786205/ASP-NET-MVC-bundling-minification-with-angularjs-a

Community
  • 1
  • 1
Josep
  • 12,926
  • 2
  • 42
  • 45
  • Unrelated to this, it looks like minification failed: /* Minification failed. Returning unminified contents. (248,386-393): run-time error JS1019: Can't have 'break' outside of loop: break a */ – Caspar Harmer Sep 22 '14 at 03:34
  • yeah i dont think thats the problem - i have another site that gives that error but the site is still running! – Linc Abela Sep 22 '14 at 03:40
  • @CaspNZ actually I think that it must be related, he must be using ASP.NET MVC Bundling and it must be crashing, maybe that's why the .map files are not available. – Josep Sep 22 '14 at 03:40
  • hah. Nice. How did you identify the 404 error? I can't find a reference to it. – Caspar Harmer Sep 22 '14 at 03:42
  • yeah worth a try - ill include the .map and we'll see. – Linc Abela Sep 22 '14 at 03:42
  • @LincAbela it's VERY obvious that your problem is with the ASP.NET MVC Bundling, that's why you only have this issue in production (when it tries to minify) and not in the dev environemnt – Josep Sep 22 '14 at 03:43
  • theinclusion .map file doesnt resolve the issue - is there any quickway to debug what file is failing to minify? i basically have hundreds of file bundled – Linc Abela Sep 22 '14 at 04:09
  • this doesnt give me any info what file are failing http://fbc38b33aa394da5a7b8fd642371f931.cloudapp.net/bundles/angular?v=uhdbMsYHeDKxwoWldbA40ueg9PLrJdldQsJ-JMKykWs1 – Linc Abela Sep 22 '14 at 04:16
  • @LincAbela in your bundle: are you using the already minified version of angular (angular.min.js)? If you are, I would try to use the non minified ones. Also: have you had a look at the links of my answer? – Josep Sep 22 '14 at 04:24
  • @LincAbela it seems to me that the minification is failing for you 'angular' bundle, there shouldn't be so many files in that bundle, right? – Josep Sep 22 '14 at 04:28
  • Yeah sees like it... when i remove the reference to https://github.com/angular-ui/ui-select, the error doesnt occur! – Linc Abela Sep 22 '14 at 04:37
  • im trying to reference the select.js (see here http://plnkr.co/edit/juqoNOt1z1Gb349XabQ2?p=preview). I think the js is failing – Linc Abela Sep 22 '14 at 04:38
  • @LincAbela if I go here: http://tradies-prototype.cloudapp.net/bundles/angular and I do a search for 'ui.select' I get nothing... Which means that the 'select.js' files is not getting included in your bundle... Why? I have no idea! In a few hours I will be in my real computer, where I have VS2013 and I will try to get that file bundled and see what happens... But at least we have been able to figure out what's causing the issue. – Josep Sep 22 '14 at 05:24
  • yeah seems like it is the issue - i added the file using bower - if I reference the file using bower, im getting wierd errors. thanks – Linc Abela Sep 22 '14 at 06:09