- Issue created by @emptyvoid
Found issues with Drupal 11 running jQuery 4.0.0-beta2 and legacy jquery.cycle.js (which is 14 years old).
Not only is the jquery.cycle.js failing but even core libraries in Drupal core are failing.
Proof I'm running jQuery 4.0.0-beta2
Load of jQuery library errors loading Drupal Core 11 with jQuery 4.0.0-beta2
To provide a bridge from legacy libraries, modules and core failures. I created a bridge module which adds back the $.isFunction() method using the "faster" expression. Instantly all of the errors go away.
However when loading the views_slideshow display the jquery.cycle.js fails with the new version of the libraries.
I isolated the code from the 14 year old code and created a patch to comment it out. From my testing, this has no affect on the functionality of the class or the drupal module settings and display/templates.
For loading the library using composer I write:
{
"type": "package",
"package": {
"name": "malsyp/cycle",
"version": "3.0",
"type": "drupal-library",
"extra": {
"installer-name": "jquery.cycle"
},
"dist": {
"url": "https://github.com/malsup/cycle/archive/refs/heads/master.zip",
"type": "zip"
},
"require": {
"composer/installers": "^2"
}
}
},
Added to one's package array.
Next you should be able to "auto-install" the library with:
composer require "malsyp/cycle"
To load the patch to comment out of offending code on composer update I first register the patch.
"enable-patching": "true",
"composer-exit-on-patch-failure": false,
"patchLevel" : {
"malsyp/cycle": "-p1"
},
"patches": {
"malsyp/cycle": {
"D11 Jquery 4 malsyp/cycle": "docroot/patches/libraries/jquery.cycle/2024-11-01-jquery_cycle_D11.patch"
}
}
Then I run a composer update and it should patch the library.
composer upgrade -w
No need to rewrite anything or deal with dependency hell.