Mismatched anonymous define() module

  • I'm trying to include jBox jQuery plugin with:

    Code
    <script src="{@$__wcf->getPath()}js/3rdParty/jBox.min.js"></script>

    in footer.tpl but it will result in an error:

    Code
    Uncaught Error: Mismatched anonymous define() module: function (jQuery) {
    return (root.jBox = factory(jQuery));
    }
    http://requirejs.org/docs/errors.html#mismatch
    at makeError (require.js?v=1502853337:168)
    at intakeDefines (require.js?v=1502853337:1251)
    at require.js?v=1502853337:1449


    Is there any other way how can I include that script?

  • Hi


    try it like this:

    Code
    require([ '{@$__wcf->getPath()}js/3rdParty/jBox.min.js' ], function (jBox) {
    // usage of jBox goes here
    new jBox('...');
    });

    The regular loading using the script tag interferes with the require.js module loader. You will need to load the script using require.js. The Callback is called, once the script has successfully been loaded.