Hello @remcotolsma,
We have informed our developers about the issue and they will take the time to investigate this and consider if we can modify the plugin to exclude such scripts.
If we require further details from your end we will update this thread.
Best regards,
Georgi Ganchev
Hi @remcotolsma,
We have included a filter to the plugin which you can use to exclude all inline scripts of type module from combination.
The filter you can use is:
add_filter( 'sgo_javascript_combine_exclude_all_inline_modules', '__return_true' );
Additionally there is a filter which will exclude all inline scripts no matter of their type as well:
add_filter( 'sgo_javascript_combine_exclude_all_inline', '__return_true' );
I hope this will be of help!
Best Regards,
Elena
Thanks, but without answers to our questions I don’t know if a filter is the best solution.
We were wondering if it might be wise for the SiteGround Optimizer to exclude scripts with type="module" from combining JavaScript by default?
Or are there situations where <script type="module" src="..."></script> can be successfully combined? (I’m not a JavaScript expert).
if <script type="module" src="..."></script> scripts should not be combined at all then you shouldn’t introduce a filter, but exclude it by default.
At this point we will not be excluding such scripts by default since that brings more risk of introducing bugs to users than using the filter when actually using it. Furthermore, each check increases the time necessary to process the request.
Hmm, without the answers to my questions I don’t know if that’s true. After all combining <script type="module" src="..."></script> by default caused an issue, that’s why this topic exists.
Yes, enabling combination does that. Exceptions are handled by default rules, interface, filter or both. This current case will be covered by a filter. I am sorry if that’s not your preferred way to handle this.
Haha, it’s not about my preferred way to handle this. I think it should be about how you can best deal the combining <script type="module" src="..."></script> elements / scripts by default. That remains a bit in the middle, but maybe it can’t get any better.