2

I have been beating my head against this for quite a while. I'm loading about 60 script files that need to respect a certain dependency structure. Loading these normally in requirejs does not work, so I started using the order plugin.

The order plugin works great in Firefox 3.6.12, IE7, IE8, but my application explodes in Chrome 8. Chrome seems to execute in any order it feels like. Is this a known issue or are there some workarounds?

1 Answer 1

7

Disclaimer, I am the main developer for RequireJS:

There has been a change in the nightly WebKits that breaks the order plugin. It also affects LABjs. It resulted in implementations of the HTML5 spec that changed dynamic script loading behavior. The good thing is that browsers are starting to converge, the bad thing is that the spec has not accounted for ordered execution of dynamically added script elements.

The author of LABjs, Kyle Simpson, has been engaging the HTML5 group to get an official spec change that supports order execution of dynamically added scripts. So far that Firefox nightlies have implemented a change, and I believe WebKit may be considering it too. Another good writeup is by Henri Sivonen.

All that said, I thought it affected WebKit nightlies, and I am not sure if Chrome 8 has picked up the change. I expect that is the likely reason for the breakage, but my unit test for the order plugin seems to work for me in Chrome 8.

If you can confirm you are on Chrome 8 and perhaps not the developer channel that might have maybe a Chrome 9, that would be good to know. It would also be good to know what version of RequireJS you are using. 0.15 has a fix that corresponds to the change in the Firefox nightlies. If you are using an older version of RequireJS you may try the newer one.

3
  • Thanks for responding, I did hear that the WebKit nightlies were broken going to be broken at jQuery Summit 2010. I'm definitely using Chrome 8, I also saw a small test on the internet that worked fine in my Chrome. Do you have any recommendations here? My main purpose for using this is to speed up development and eventually use the build optimizer. The build tool is a bit of a nuisance, since it seems to be ignoring any scripts included with the order! prefix.
    – Drew
    Commented Dec 15, 2010 at 15:17
  • As a sanity check, I just dumped the scripts in order as I sent then to requireJS as normal script tags in my html. This worked fine in Chrome8 and FF3. Is there some debugging options I have available to see whats failing to load here?
    – Drew
    Commented Dec 15, 2010 at 15:35
  • 1
    The optimizer has been improved to work well with order! dependencies now in the just released 0.2.0, so hopefully that will help the build situation. You may also want to try the 0.2.0 release, there were some bug fixes and changes around the order plugin. If that does not work, please feel free to contact me if you have a reproducible test case, and I can take a look at it.
    – jrburke
    Commented Dec 16, 2010 at 9:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.