Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top