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
- Install the module.
- See the inclusion of the css file that includes the file like
/modules/contrib/navigation_extra/assets/css/navigation_extra_version.css?tayh9a - Add a patch from for example #3573191: Environment color not working with newer version of Gin (5.0.11+) where the CSS is changed or change CSS yourself.
- See there is no change, even after a cache clear.
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.
Issue fork navigation_extra-3575391
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
Comment #3
tim-dielsComment #4
dtfabio commentedComment #5
dtfabio commentedHi 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
Comment #7
tim-dielsThanks for the review. I agree with removing this.