0

We're having trouble including breeze.debug.js in our BundleConfig.cs. After adding it in BundleConfig, it never gets downloaded to the browser (as seen - or not seen, in this case - in the Network tab of the browser's dev tools). And, we always get an error - Uncaught Error: Can't find breeze from breeze.angular.js:90 - which is loaded in BundleConfig right after breeze.debug.js.

We've seen this question:

New ScriptBundle .Include not working for breeze.min.js New ScriptBundle .Include not working for breeze.min.js

but none of the 'answers' work.

We've tried:

  • creating a new global.asax - doesn't work
  • making sure that both the debug and min files are in the bundle - doesn't work

Here is our BundleConfig.cs:

bundles.Add(new ScriptBundle("~/bundles/thirdparty")
    .Include("~/Scripts/jquery-{version}.js")
    .Include("~/Scripts/jquery-ui-{version}.js")
    .Include("~/Scripts/angular.js")
    .Include("~/Scripts/angular-animate.js")
    .Include("~/Scripts/angular-route.js")
    .Include("~/Scripts/angular-sanitize.js")
    .Include("~/Scripts/bootstrap.js")
    // breeze.debug.js doesn't work in BundleConfig.cs!!!
    //.Include("~/Scripts/q.js") // we've tried with q.js and without q.js - neither works
    .Include("~/Scripts/breeze.debug.js")
    .Include("~/Scripts/breeze.angular.js")
    .Include("~/Scripts/toastr.js"));

Bottom line is BundleConfig downloads all other scripts to the browser without any problems. It's only breeze.debug.js that never gets downloaded. And, by the way, we're using the latest versions of breeze (all scripts actually).

So, help?! What needs to be done to be able to add breeze.js to BundleConfig.cs and actually have it work?

Thanks.

Community
  • 1
  • 1
lmttag
  • 2,499
  • 4
  • 26
  • 30
  • The only time the bundler doesn't include scripts is when it can't find the file at the path specified. It always fails silently, just skipping over the script instead of raising an exception. – Chris Pratt Dec 09 '14 at 22:09
  • Thanks for the info, Chris. But, yeah, that script file is definitely in the Scripts folder with all the other .js files. We've tried adding breeze.js using the NuGet package, as well as downloading and adding the scripts manually. Yet, still nothing. It's weird that breeze.angular.js downloads fine, but breeze.debug.js (or breeze.min.js) won't get recognized by the bundler. – lmttag Dec 09 '14 at 22:17
  • 1
    For the sake of troubleshooting, does adding the script reference directly in the head work? i.e. breeze.debug.js not in the bundle – Brent Mannering Dec 09 '14 at 22:40

1 Answers1

2

I'll bet the problem is the word "debug" in the name "breeze.debug.js". As I recall, ASP.NET bundling excludes any file with that word in its name from production bundles.

Here's a StackOverflow thread on this topic.

I wish I remembered the exact incantation. I don't use bundling anymore myself but I got it to work a while back. You may have to do a little digging and messing around to get this just right. It does work.

Community
  • 1
  • 1
Ward
  • 17,793
  • 4
  • 37
  • 53
  • Like the referenced thread says, you should just use `.Include("~/Scripts/breeze.js")` and the bundler will automatically use `breeze.debug.js` when running in debug mode. – Steve Schmitt Dec 10 '14 at 05:25
  • Thanks Ward! (and Steve) You're right, the word "debug" in the file name was causing bundling to ignore it. I knew that, but, in my haste to get it working, I guess I just overlooked it. Shoot! Thanks again. – lmttag Dec 10 '14 at 15:37
  • By the way, Ward, you mentioned you're not using ASP.NET bundling any more, so what are you using for bundling and minification of your JavaScript resources? Our project is currently still an ASP.NET MVC app and we're using VS 2013, so we have been still using its bundling capabilities. – lmttag Dec 10 '14 at 15:41
  • Living the bower/node/gulp life. John Papa is leading the way (watch for his PluralSight course). FWIW, this is the future of VS. I expect ASP bundling to fade away. – Ward Dec 10 '14 at 20:09