Hi Fellow Magento Users!

I have a little problem with loading Javascripts.
On first pageload after a cleanup of files and upgrade:setup i experience a page that loads javascripts really slow, and there is a lot of them, but absolutely no errors.
however on second load javascripts is loaded in a bit different position, they come fast but it results in JS errors like;

dataPost.js:13 Uncaught TypeError: $.widget is not a function.

As if jquery is not loaded, however jquery.js is loaded before RequireJs starts to add scripts. And the scripts that changes their position are loaded from RequireJs.
Options like minify and combine are all disabled - Aswell as caching but, if i turn this around and active minify and combine of javascripts, it will generate errors on first page load, however on second page load it will load combined resources for the scripts that is not loaded by RequireJs and it generates no errors at all - but the total amount of loaded javascripts are with this option about 146, however without combination it is only 89 scripts

Does any one have a tip on how to deal with this?

  • I don't think you shouldn't be loading jQuery outside of require, it should be set up as a dependency and each require module that requires it can load it independently. Did you manually add jquery.js? – Ben Crook Sep 4 '16 at 13:25
  • Hi @Ben-Space48 You are so right. The theme have included jquery externally from RequireJs. Doing changes to this made most errors disappear :-) – Stian Blåsberg Sep 10 '16 at 11:34
  • Glad to of helped! – Ben Crook Sep 12 '16 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.