`Error: Mismatched anonymous define() module` on the BBC website
See original GitHub issueHi,
We’re trying to use iframe-resizer
on an embed on the BBC website. However, it fails with the following errors:
Uncaught ReferenceError: iFrameResize is not defined
Uncaught Error: Mismatched anonymous define() module: function p(){function t(e,n){if(!e.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==e.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+e.tagName+">.");m.call(e,n)}return n(),e(window,"message",a),e(window,"resize",w),function(e,n){switch(typeof n){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(n||"iframe"),function(n){t(n,e)});break;case"object":t(n,e);break;default:throw new TypeError("Unexpected data type ("+typeof n+").")}}}
This error is documented here: http://requirejs.org/docs/errors.html#mismatch.
If you manually code a script tag in HTML to load a script with an anonymous define() call, this error can occur.
I am solving it now by patching the iframeResizer.js
code to always export a global, even if the page uses RequireJS modules. I thought it’s something you should be aware of though.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
RequireJS Error: Mismatched Anonymous Define() Module
Templates with scripts that leverage RequireJS code and were working prior to upgrading to 9.0 now show an error in the console of...
Read more >Mismatched anonymous define() module - Stack Overflow
Another possible solution, in some special cases with anonymous modules is to overwrite the requirejs.onError function in order to prevent the default error...
Read more >Troubleshooting mismatched anonymous define
(index):10 Uncaught Error: Mismatched anonymous define() module: function(){return wr} http://requirejs.org/docs/errors.html#mismatch at ...
Read more >Uncaught Error: Mismatched anonymous define() module
Uncaught Error: Mismatched anonymous define() module ... when SCRIPT_DEBUG is false which is correct for production/live website, requirejs is not loaded, ...
Read more >Uncaught Error: Mismatched anonymous define() module
"define" actually trying to add jquery to you DOM, ... this path = app/code/Sample/Module/view/adminhtml/web/js/restore-order.js where you ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@YoranBrondsema or anyone else who understood what was met
If anyone else gets stuck here, I just replaced define with require and it worked.
I get this error on https://www.cambridgechorale.org.uk/concerts/the-passing-of-the-year-cambridge because the https://helmtickets.com IFRAME widget is using the plug-in and the site uses require.js.