Remove separate cookies/cookiesjsr.cdn library and use cookies/cookiesjsr instead

Created on 5 August 2022, over 2 years ago
Updated 11 December 2024, 4 months ago

Problem/Motivation

Based on the discussion in #3301609: JS has hard dependency of cookies/cookiesjsr causes double load of cookiesjsr-preloader I think we should remove the additional cookies/cookiesjsr.cdn library and instead use cookies/cookiesjsr as only library definition for cookiesjsr.

With a hook_library_info_alter we should change the source, if CDN is enabled.

Why?
At first glance this sounds a bit weird, but I think it's an antipattern to use different libraries for the same "library" depending on the source. As library dependencies are kind of "API" which other modules can depend on, they would otherwise have to duplicate the logic for CDN / local switch.

Anyway this is minor, as typically COOKiES submodules and extending modules don't have to have a dependency on cookiesjsr if they call none of the cookiesjsr API functions. Only reacting to an event doesn't require a dependency in code. Nothing breaks, if the event isn't called!
That also turned out in the linked issue.

Steps to reproduce

Proposed resolution

  • Use hook_library_info_alter to change the source of cookies/cookiesjsr for CDN
  • Remove cookies/cookiesjsr.cdn

Remaining tasks

  1. Discuss
  2. Implement
  3. Ensure tests
  4. Release

User interface changes

None

API changes

Data model changes

Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024