4

Closed

Resources not being included in correct order (intermittent issue)

description

This seems to have started happening within the past month, and it's a little annoying during development.

Here's what happens: you make some changes, hit Ctrl+F5, and javascript doesn't work properly on your site. You look at the console in browser's dev tools, and see errors like "Uncaught ReferenceError: jQuery is not defined". In the view source, you notice that jquery.js is being included after scripts that have declared a dependency on jquery.js. For example, in one of my pages where I'm having this issue, I'm using these Script includes in my .cshtml:
Script.Require("jQuery");
Script.Require("jQueryUI_Button");
Script.Require("jQueryUI_Tabs");
Script.Require("jQueryUI_Slider");
Script.Require("jQueryUI_Dialog");
Script.Require("jQueryUI_Slider");
, and the jQueryUI_... resources have declared deps on jQuery. But they are included before jquery in the html.

Usually after one or more cycles of killing Cassini, cleaning the solution, rebuilding, and launching via Ctrl+F5 again, the problem goes away for a while. We mentioned this during this week's orchard weekly meeting and at least one or two other people mentioned they too were having this problem.

file attachments

Closed Dec 18, 2012 at 7:48 AM by sebastienros
Should be fixed in 1.x now, please check

comments

Piedone wrote Nov 12, 2012 at 12:33 PM

I just stumbled upon this as well. A Cassini restart solved it. In my particlar case MediaPicker and jQuery UI got included before jQuery itself. My template has a Script.Require("jQuery").AtFoot() with some inline js using (Script.Foot()) at the bottom.

paynecrl97 wrote Nov 21, 2012 at 11:30 AM

I have noticed this, and logged an issue with id 19263. I didn't realise it had already been logged when I raised my issue.

paynecrl97 wrote Dec 20, 2012 at 1:12 PM

This happens for me in 1.6.

In fact, it's just happened again. See the attached screen shot. You can see that the Layout.cshtml file includes jQuery, bootstrap.min, jCarousellite then bootstrapcasino.js. However, files are rendered as bootstrap.min, jCarousellite then bootstrapcasino.js then jQuery- causing the javascript errors in the console.

Can this be re-opened please?

TheMonarch wrote Dec 20, 2012 at 2:06 PM

@paynecrl97, Which changeset did you test with?

paynecrl97 wrote Jan 7 at 3:11 PM

@TheMonarch, I get this with Orchard v1.6.0.0