If your WordPress is running on a Litespeed server, there is a known issue with the Litespeed Cache Load JS Deferred feature.
When the Litespeed Load JS Deferred feature is set to “Delayed”, it is known to cause issue even in core WordPress, WooCommerce and several other plugins as shown in the support forums:
https://wordpress.org/support/topic/problems-with-scripts-that-are-connected-to-wp_localize_script
https://wordpress.org/support/topic/script-loading-strategies-by-wp-and-load-js-deferred-by-ls
https://wordpress.org/search/js+delay+intext%3A%22Plugin%3A+LiteSpeed+Cache%22
Solution
- Login to your WordPress admin dashboard.
- Go to the Litespeed Cache menu.
- Page Optimization > [2] JS Setting.
- Load JS Deferred: OFF
- Purge cache.