You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My pages have been facing "Multiple anonymous defines encountered" irregularly for some time, and I have finally understood why :
I have set up a minimalistic page to demonstrate the error : http://jsbin.com/suhehuwita/1/
This page triggers the error very reliably, but in a real world web page with more modules, it would happen randomly.
Basically, if an AMD-compatible module is loaded after curl, outside a call to curl(), the error will be triggered.
What you should not do:
<html><head><scripttype="text/javascript">curl={/* curl config */};</script><scriptsrc="/curl.js"></script><scriptsrc="/some-amd-module.js"></script><!-- after curl --></head><body><scripttype="text/javascript">curl("same-amd-module",function(){});</script></body></html>
What you should do instead:
<html><head><scripttype="text/javascript">curl={/* curl config */};</script><scriptsrc="/some-amd-module.js"></script><!-- before curl --><scriptsrc="/curl.js"></script></head><body><scripttype="text/javascript">curl("same-amd-module",function(){});</script></body></html>
The text was updated successfully, but these errors were encountered:
Thanks @NotSqrt! This is a common problem encountered by people mixing AMD loaders and <script> elements that might load AMD modules. I'm glad you figured it out and left a solution for others! -- J
My pages have been facing "Multiple anonymous defines encountered" irregularly for some time, and I have finally understood why :
I have set up a minimalistic page to demonstrate the error : http://jsbin.com/suhehuwita/1/
This page triggers the error very reliably, but in a real world web page with more modules, it would happen randomly.
Basically, if an AMD-compatible module is loaded after curl, outside a call to curl(), the error will be triggered.
What you should not do:
What you should do instead:
The text was updated successfully, but these errors were encountered: