Closed SerhiiMandrykin closed 1 year ago
Hey @SerhiiMandrykin, thanks for reporting the issue! Would you be able to search the files and paste the full contents of the module that throws this error? It would be easier for me and @fredden to debug this.
Hi, here having this Uncaught Error: Mismatched anonymous define()
issue too , First it was complaining about this file I am using https://github.com/rstacruz/jquery.transit/blob/master/jquery.transit.js
Which I am adding as a dep from requirejs-config.js
deps: [ 'Module_Name/js/resource/transit/jquery.transit' ]
Then it complained about lib/web/jquery/jquery.storageapi.min.js too, which seems defined in vendor/magento/module-theme/view/base/requirejs-config.js So I really have no idea what's going on :-(
Btw using Magento 2.4.2-p1 and latest Magepack 2.11.0, the issue not happening when using Magepack 2.10.1
I've tracked this down to the changes introduced in #142 and minified content. The example I've found is from moment:
function(a,b){"use strict";"function"==typeof define&&define.amd?define(["moment"],b):"object"==typeof module&&module.exports?module.exports=b(require("moment")):b(a.moment)}(
Version 2.8.0 identifies this as an AMD module and names it, but version 2.11.0 doesn't identify this as an AMD module, so wraps it, leading to the duplicate define()
call within the new wrapper. I'll open a pull request to fix this shortly.
Nice, that's a downside of trying to parse code with regular expressions 😄 That said, the more corner cases we find, the more tests we'll have and we should be safer in the future.
the more tests we'll have and we should be safer in the future.
Yes, I've written the test first this time. :)
After updating our magepack to the version 2.11.0 we were facing the error like:
After rolling back to 2.10.1 the error has gone.