• Resolved kschlager

    (@kschlager)


    Depending on a script that is only registerred and not enqued, does not work with Autoptimize’s aggregate function.

    wp_register_script('script-a', '/script-a.js'), array());
    wp_enqueue_script('script-b', '/script-a.js'), array('jquery', 'script-a'));

    In the example above script-a is missing when Autoptimize is active with aggregate (autoptimize_js_aggregate). Disabling Autoptimize or switching to defer only (autoptimize_js_defer_not_aggregate). Fixes the issue.

    I don’t know which version introduced this error. We are currently using version 3.1.11.

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

    (@optimizingmatters)

    afraid Autoptimize does not *know* about WordPress enqueuying, as it “looks” at the output HTML long after the enqueuing was done. AO then loosk at settings and specifically exclusions to optimizes the page accordingly.

    so the question becomes what is causing script-a.js to disappear. do you have a test-site where you could leave things broken for me to inspect the HTML?

    Thread Starter kschlager

    (@kschlager)

    Thank you for your quick response.

    I overlooked, that in our case script-b is enqueued via wp_enqueue_script() but the output (filter ‘script_loader_tag’) is modified to be type=”module”. Modules are not aggregated nor deferred. So the loading order is not right.
    We will get around this on our side.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Modules are not aggregated nor deferred.

    indeed ??

    Thank you for your quick response.

    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 ‘Autoptimize does not aggregate registerred-only scripts’ is closed to new replies.