Make WordPress Core

#60742 closed defect (bug) (fixed)

Script Modules: Module src not filterable.

Reported by: dd32's profile dd32 Owned by: swissspidy's profile swissspidy
Milestone: 6.5 Priority: normal
Severity: normal Version: 6.5
Component: Script Loader Keywords: has-patch commit dev-reviewed fixed-major
Focuses: Cc:

Description

The new Script Modules feature doesn't allow the URL being imported to be filtered, this means that it's not possible for plugins to either filter it to load from a CDN, or add/alter params (Such as we do on WordPress.org for cache issues).

At a minimum WP_Script_Modules::get_versioned_src() should have a filter, ideally it could re-use the script_loader_src filter for maximum compatibility with existing script-related filters, but it could use something specific like script_module_src if required for some reason.

Change History (8)

#2 @jorbin
11 months ago

  • Milestone changed from Awaiting Review to 6.5

Moving to 6.5 for visibility.

#3 @swissspidy
11 months ago

  • Owner set to swissspidy
  • Status changed from new to reviewing

#4 @swissspidy
11 months ago

  • Keywords commit dev-reviewed added

#5 @swissspidy
11 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 57840:

Script Loader: Add new script_module_loader_src filter for the script module src.

Ensures parity with the script_loader_src filter for regular scripts, allowing the URL to be filtered, for example to load them from a CDN or alter query parameters.

Props dd32, peterwilsoncc, westonruter.
Fixes #60742.

#7 @swissspidy
11 months ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

#8 @swissspidy
11 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 57844:

Script Loader: Add new script_module_loader_src filter for the script module src.

Ensures parity with the script_loader_src filter for regular scripts, allowing the URL to be filtered, for example to load them from a CDN or alter query parameters.

Reviewed by swissspidy.
Merges [57840] to the to the 6.5 branch.

Props dd32, peterwilsoncc, westonruter.
Fixes #60742.

Note: See TracTickets for help on using tickets.