Performance vs plugin genrated javascript

When enqueuing a custom script, you can write them to load in the footer – prior to the </body> tag – making them non-render blocking for most purposes, but they may still come up as render-blocking on testing tools, since they literally must be executed before the page HTML can be considered fully loaded. Instead, you will want to “defer” most, but not all scripts.

Deferring will mean literally adding the “defer” attribute to the script tag, and, to achieve the desired effect with scripts loaded by theme or plugin, WordPress offers the script_loader_tag filter, but you will need to exercise caution, since some scripts will break or cause other scripts to break if loaded too late. (You can try “async” instead, which might be preferable for scripts that you want or need to load somewhat earlier, if with some execution time penalty while the page load is occurring.)

This post explains in detail how you would go about the process of handling a potentially large number of scripts “by hand”: https://wpshout.com/make-site-faster-async-deferred-javascript-introducing-script_loader_tag/ There are also several plugins available for the task – I use Async Javascript at many sites