Do not use Drupal Core's version for libraries

Created on 20 August 2025, about 2 months ago

Problem/Motivation

When updating dropzonejs but not drupal/core, the JavaScript cache-busting parameter remains the same (e.g. ?v=10.4.8). When updating drupal/core but not dropzonejs, the JavaScript cache-busting parameter changes.
LibraryDiscoveryParser applies the Drupal version to every library that uses version: VERSION. It does not use the modules version.

See the note on Adding assets (CSS, JS) to a Drupal module via *.libraries.yml :

Starting from Drupal 10.1.2, the version information within a library definition plays a critical role in generating a unique hash for aggregated files. Consequently, it is imperative that the "version" in a library definition is updated whenever a referenced CSS/JS file undergoes changes.

Alternatively, if the version is omitted, the prior behavior will apply, where the content of referenced CSS/JS files is utilized in the hash.

Incorrect usage of version information could lead to browser and edge cache invalidation issues.

See this update on the related changelog .

Steps to reproduce

First case

  • Use dropzonejs 2.10, use drupal/core 10.4.8
  • Disable JS preprocessing
    $config['system.performance']['js']['preprocess'] = FALSE;
  • Open "Add or select media" modal
  • Look at site's DOM and see
    <script src="/modules/contrib/dropzonejs/js/dropzone.integration.js?v=10.4.8"></script>
  • Update dropzonejs to 2.11
  • Open "Add or select media" modal
  • Look at site's DOM and see
    <script src="/modules/contrib/dropzonejs/js/dropzone.integration.js?v=10.4.8"></script>

Second case

  • Use dropzonejs 2.11, use drupal/core 10.4.7
  • Disable JS preprocessing
    $config['system.performance']['js']['preprocess'] = FALSE;
  • Open "Add or select media" modal
  • Look at site's DOM and see
    <script src="/modules/contrib/dropzonejs/js/dropzone.integration.js?v=10.4.7"></script>
  • Update drupal/core to 10.4.8
  • Open "Add or select media" modal
  • Look at site's DOM and see
    <script src="/modules/contrib/dropzonejs/js/dropzone.integration.js?v=10.4.8"></script>

Proposed resolution

Remove version: VERSION from dropzonejs.libraries.yml

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany hosterholz

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024