JS error after enable bundling functionality: Uncaught Error: Mismatched anonymous define() module: undefined
Magento version: 2.4.4
-
Hi guys,
Issue seems to be from magento's core file: https://github.com/magento/magento2/blob/2.4.5-p1/lib/web/jquery/ui-modules/core.jsAffected versions seem to be 2.4.4 and 2.4.5 including all patched versions.
Quick fix for this would be to apply a patch for this file in your Magento's instance and replace it with the following content:( function() {
"use strict";
define('jquery/ui-modules/core', [
"jquery",
"./data",
"./disable-selection",
"./focusable",
"./form",
"./ie",
"./keycode",
"./labels",
"./jquery-patch",
"./plugin",
"./safe-active-element",
"./safe-blur",
"./scroll-parent",
"./tabbable",
"./unique-id",
"./version"
] );
} )();Or in your bundling file, advancedbunlding_build.js replace the following last lines:
]
});with:
],
onBuildRead: function (moduleName, path, contents) {
if (moduleName == 'jquery/ui-modules/core') {
if (
contents.includes('"./disable-selection",') &&
contents.includes('"./focusable",') &&
contents.includes('"./keycode"') &&
contents.includes('"./safe-active-element"')
) {
contents = contents.replace("define( [", "define([");
contents = contents.replace("define([", "define('jquery/ui-modules/core', [");
}
}
return contents;
}
});In the new version of the module this fix will be included as well.
Regards,
Szabi
-
THANK YOU Koncz Szabocls
I have the same problem and luckily you answered exactly the right answer 2 days ago :))))
This is definitly a bug in Weltpixel Speed Optimizing Modul!
After bundling on all pages in Store the JS-error occurs "Uncaught Error: Mismatched anonymous define() module: undefined". The error links to a file which is not part of the bundling-file, so there is no solution.Thank you for yours, saved my day !!
Please sign in to leave a comment.
Comments
5 comments