• Resolved sermalefico

    (@sermalefico)


    If i put /wp-includes/ folder in Merge and Defer Scripts option like help page
    in my frontend see this error

    (index):85 Uncaught ReferenceError: _ is not defined
        at (index):85
    (anonymous) @ (index):85
    (index):86 Uncaught ReferenceError: wp is not defined
        at (index):86
        at (index):86
    (anonymous) @ (index):86
    (anonymous) @ (index):86
    (index):87 Uncaught ReferenceError: wp is not defined
        at (index):87

    I think is a one of this files,

    /wp-includes/js/dist/i18n.min.js
    /wp-includes/js/dist/vendor/lodash.min.js
    /wp-includes/js/dist/vendor/Scriptapi-fetch.min.js
    /wp-includes/js/dist/vendor/Scripthooks.min.js
    /wp-includes/js/dist/vendor/Scripturl.min.js

    can you check this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter sermalefico

    (@sermalefico)

    And another thing…

    Google speed insights warning me to use HTTP/2 and the server have http/2. When deactivate FVM no warning apears all is fine and HTTP/2 works.

    Plugin Author Raul P.

    (@alignak)

    This is not a problem of the plugin.
    You have to decide which plugins can and cannot be deferred, manually.
    Not all of the js files can be deferred, or even merged at all.

    If the /wp-includes/ is too borad, you need to be more specific and name the files one by one directly.

    If it’s telling you that wp is not defined you need to check where is the message coming from. Most likely, it’s an inline script that expects a js file to be render blocking before it.

    If you are deferring it, it will only load after, instead of before.

    So your options are to defer the inline code as well, or render block the affected file.

    Usually, for those errors you can defer this inline scripts:

    wp.i18n
    wp.apiFetch.use
    window.lodash

    But again, it depends on what you have on your site.
    It could be something else, so as the plugin says, this is a tool for developers and you need to try one by one and understand how to use it (or hire someone).

    FVM has nothing to do with http/2.
    That is a server setting, and FVM does nothing about the server.

    Check if it also shows on gtmetrix.
    Google pagespeed had a bug recently and it was showing that error and others randomly.
    It was updated a couple of weeks ago.

    I am using slider revolution plugin and when i merge and defer the wp-includes js then slider is not showing in frontend.
    And in console , jquery is not defined message is displayed.

    Any settings or solution to manage this issue ?

    Thread Starter sermalefico

    (@sermalefico)

    Merge render blocking JS files in the header:
    /js/rs6.min.js
    /js/rbtools.min.js

    Thread Starter sermalefico

    (@sermalefico)

    For compatibility with last Contact form 7 and classic editor:

    Merge and Defer Scripts:
    /plugins/contact-form-7/includes/js/index.js

    Inline JavaScript Dependencies:
    wp.i18n
    wp.apiFetch.use
    window.lodash
    wp.hooks
    wp.url

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Prolem when Merge and Defer Scripts from wp-includes’ is closed to new replies.