• Resolved formatfabriken

    (@formatfabriken)


    Hi,

    We recently upgraded from wordpress 5.6 to 5.8.
    After the upgrade all JS / Jquery related functionality ceased to function.
    Deselecting the “aggregate JS file” option in Autoptimize resolved the issue.

    But since nothing else changed that doesn’t make sense to me. Inspect / Console displays the following (if the JS files ARE aggregated):

    Uncaught TypeError: Cannot read properties of undefined (reading 'apply')
        at Function.e.<computed> [as unique] (autoptimize_820f524efb7c835466291c97605415d4.js:2)
        at s.fn.init.add (jquery-1.11.0.min.js?ver=1.1:2)
        at s.fn.init.addBack (jquery-1.11.0.min.js?ver=1.1:2)
        at String.<anonymous> (autoptimize_820f524efb7c835466291c97605415d4.js:717)
        at Function.each (jquery-1.11.0.min.js?ver=1.1:2)
        at Object.reflow (autoptimize_820f524efb7c835466291c97605415d4.js:717)
        at s.fn.init.s.fn.foundation (autoptimize_820f524efb7c835466291c97605415d4.js:717)
        at autoptimize_820f524efb7c835466291c97605415d4.js:719

    The error points to a row that deals with jQuery Migrate functionality. I believe WordPress changed / added stuff related to that around ver. 5.5.

    function migrateWarnFunc(obj, prop, newFunc, msg) {
            obj[prop] = function() {
                migrateWarn(msg);
                return newFunc.apply(this, arguments);  <--- Uncaught TypeError: Cannot read properties of undefined (reading 'apply')
            }
            ;
        }

    Any why would Autoptimize cause this when the issue isn’t a factor with aggregation turned off?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, by default AO excludes jquery.min.js from being aggregated/ optimized, but not jquery-migrate.min.js, so try adding jquery-migrate.min.js to the comma separated JS optimization exclusion list maybe?

    frank

    Thread Starter formatfabriken

    (@formatfabriken)

    That’s… smart.
    And yeah, it cleared the console of those error and returned the site to full functionality.

    Thanks!

    Any clue as to why jquery-migrate.min.js would cause those issues when aggregated?
    This is is out of my league stuff.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Any clue as to why jquery-migrate.min.js would cause those issues when aggregated?

    if your theme or a plugin adds inline JavaScript (which is unaggregated and thus executes early) that relies on old jQuery functions, then jQuery-migrate is needed early for those.

    Thanks!

    you’re welcome, feel free to leave a review of the plugin and support here! ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘JS file aggregation causes JS to stop working after Worpdress upgrade’ is closed to new replies.