You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
I am reviewing WP_Service_Worker_Scripts_Integration->register()
The method uses WP Core filter script_loader_src and then adds the version value to the url. I have a question about the sequence of these actions.
The filter script_loader_src can be used anywhere for cleanup url. In this case, the cleaned url without additional arguments are included in the page markup. While the plugin will continue to use url with an additional argument.
Unfortunately, I did not have time to delve into the knowledge of how SW works to determine the correctness of this behavior. However, if the script preload links differ from the script markup links, this behavior results in an error.
Hi there. Yeah, I actually do not recommend using WP_Service_Worker_Scripts_Integration. As noted in the wiki, the integrations are experimental and I intend to deprecate them (#403). A problem with WP_Service_Worker_Scripts_Integration is that it precaches scripts even if those scripts never get used. It is normally preferable rather to use the runtime cache to instead cache scripts that are actually used.
Hi!
I am reviewing
WP_Service_Worker_Scripts_Integration->register()
The method uses WP Core filter
script_loader_src
and then adds the version value to the url. I have a question about the sequence of these actions.The filter
script_loader_src
can be used anywhere for cleanup url. In this case, the cleaned url without additional arguments are included in the page markup. While the plugin will continue to use url with an additional argument.Unfortunately, I did not have time to delve into the knowledge of how SW works to determine the correctness of this behavior. However, if the script preload links differ from the script markup links, this behavior results in an error.
If the filter fire last, the url may be the same.
WP Core reference:
https://github.com/WordPress/WordPress/blob/52679edbffe1a28cf7fce54ab2077f299c8cf27e/wp-includes/class.wp-scripts.php#L375-L382
The text was updated successfully, but these errors were encountered: