Issue with jquery-ui-effect (Magento 2.4.4)
See original GitHub issueEdit 03/05/2022 : Just remove the two files from the magepack.config.js to solve the issue…
Good afternoon,
I have a situation with your wonderful extension and the new released magento 2.4.4 version. Indeed, the two files from jquery-ui updated framework :
Which were reworked from the previous version, throws an error only when I magepack them (with the standard minification and bundle I do not have any issue).
This is the error I have in my developer console for the homepage :
Uncaught Error: Mismatched anonymous define() module: function($){"use strict";return $.effects.define("fade","toggle",(function(e,t){var n="show"===e.mode;$(this).css("opacity",n?0:1).animate({opacity:n?1:0},{queue:!1,duration:e.duration,easing:e.easing,complete:t})}))}
This error is also throwed by blind effect.
So far, I can either remove them from the magepack.config.js (requirejs we will download them as standalone version) or correct them manually by naming them.
Exemple for effect-fade.js :
/*!
* jQuery UI Effects Fade 1.13.0
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Fade Effect
//>>group: Effects
//>>description: Fades the element.
//>>docs: http://api.jqueryui.com/fade-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Naming the module
define('jquery-ui-effect-fade', [
// AMD. Register as an anonymous module.
//define( [
"jquery",
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
return $.effects.define( "fade", "toggle", function( options, done ) {
var show = options.mode === "show";
$( this )
.css( "opacity", show ? 0 : 1 )
.animate( {
opacity: show ? 1 : 0
}, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
} );
} );
} );
These two JS files are used for :
- fade.js for minicart
- blind.js for message
a Pull Request advice to suppress them for the native code of Magento for native CSS Transition and native function from jQuery itself : https://github.com/magento/magento2/pull/32886
Not sure if this error come from our current configuration as it heavy customized,
Did you meet this issue also on Magento 2.4.4 ?
Magento 2.4.4 have also a mapping error for Magento_Theme module (which is not related to my current issue) : https://github.com/magento/magento2/issues/35327
Issue Analytics
- State:
- Created a year ago
- Reactions:7
- Comments:13 (2 by maintainers)
Top GitHub Comments
I have had the same issue and to work around this temporarily decided to go with naming the modules, however my issue wasn’t just with the 2 classes mentioned in the OP description but with most of the jQuery UI effects. The main reason for naming rather than removing is that when the config was generated again the changes would again have to be made manually and there would be a chance this would be missed, instead i have created a
.patch
to be installed when composer runs.Patch for
magento/magento2-base
Based on a site running 2.4.5-p1, ui-modules/core may also trigger the anonymous define issue.