Problem/Motivation

The library definitions currently include a VERSION string in *.libraries.yml. In Drupal core, the VERSION constant refers to the Drupal core version. Contributed modules and themes should not rely on that value for asset versioning, because it can lead to stale assets being served after CSS/JS changes. See #2205027: VERSION in library declarations does not work for contributed/custom modules

This is especially risky behind CDNs and other intermediate caches: if the theme updates an asset file but the library version does not change, cache invalidation may not happen as expected, and users can receive outdated CSS/JS.

Steps to reproduce

Proposed resolution

Remove the version definition in libraries.

Remaining tasks

Create and review MR.

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tim-diels created an issue. See original summary.

tim-diels’s picture

Status: Active » Needs review
dtfabio’s picture

Assigned: Unassigned » dtfabio
dtfabio’s picture

Assigned: dtfabio » Unassigned
Status: Needs review » Reviewed & tested by the community

Hi Tim,

I have attempted to test the change on four different instances, but I am unable to reproduce the issue locally (with the provided test steps).

Drupal core versions: 10.3.14, 10.6.3, 11.2.10 and 11.3.3
PHP versions: 8.3.30 (10.3) and 8.4.18 for the newer core versions.
Database version: MariaDB 11.8.6 and MySQL 8.4.5

However, given that it is best practice not to use version for packages in contrib modules and that it had no impact on any of the tested instances, I believe it is acceptable to merge.

So I'm putting the ticket in RTBC. If anyone else has relevant feedback as to why this might not be the case, please feel free to share it.

Greetings,

Fabio

  • tim-diels committed d24b0fc9 on 1.0.x
    feat: #3575391 Remove VERSION string from library definitions
    
tim-diels’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the review. I agree with removing this.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.