Problem/Motivation
The module defines its JavaScript library with both minified: false and preprocess: false:
js/jquery.deprecated.functions.js: { minified: false, preprocess: false, weight: -20 }
Because preprocessing is disabled, Drupal does not include the file in JavaScript aggregation or minification, even when JavaScript aggregation is enabled on the site.
This causes the unminified source file to be served separately on production sites. It may also trigger performance and SEO audit warnings about unminified JavaScript.
It is unclear whether preprocess: false is required for compatibility or whether it was just copied from Drupal core's jQuery library definition, where the referenced jQuery file is already minified.
Steps to reproduce
- Install and enable the jQuery Deprecated Functions module.
- Enable JavaScript aggregation at
/admin/config/development/performance. - Clear Drupal caches.
- Visit a page where the module's library is loaded.
- Inspect the page's JavaScript resources in the browser developer tools.
The file is loaded directly from the module directory:
/modules/contrib/jquery_deprecated_functions/js/jquery.deprecated.functions.js
It is not included in a generated Drupal JavaScript aggregate and remains unminified.
Proposed resolution
Remove preprocess: false from the library definition so Drupal can aggregate and minify the file using its standard asset processing system:
js/jquery.deprecated.functions.js: { minified: false, weight: -20 }
Alternatively, set preprocess: true explicitly.
If the file must remain excluded from preprocessing for compatibility reasons, document that requirement and consider providing a pre-minified version of the file instead.
Remaining tasks
- Confirm whether
preprocess: falseis required for any compatibility or execution-order reason. - Test with JavaScript aggregation enabled.
- Verify that the deprecated jQuery functions remain available before dependent scripts execute.
- Test supported Drupal core versions.
- Add or update automated test coverage if applicable.
- Review and commit the proposed change.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3615119-aggregated.png | 235.19 KB | danrod |
| #4 | 3615119-aggregation-issue.png | 214.93 KB | danrod |
| #2 | jquery_deprecated_functions-preprocess-3615119-1.patch | 496 bytes | mekal |
Issue fork jquery_deprecated_functions-3615119
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 #2
mekal commentedhere is a patch that is working for me.
Comment #3
danrodComment #4
danrodThanks for submitting this patch, I can see the issue in my D11 instance:
After applying the patch, the file was aggregated:
I'll test that deprecated jQuery functions remain available before dependent scripts execute.
Comment #6
danrodComment #7
danrodComment #8
danrodComment #9
danrodI tested this on a project that has Views Slideshow installed and works as expected after applying thte MR !24. I'll merge this to the 1.0.x branch.
Comment #11
danrodThanks for the fix.
Comment #12
danrod