yireo / Yireo_Webp2

Magento 2 module to add WebP support to Magento 2
Open Software License 3.0
197 stars 57 forks source link

target.extend javascript error #103

Closed kylianleemkuil closed 2 years ago

kylianleemkuil commented 2 years ago

Hi @jissereitsma ,

I noticed that on every product page that it's only showing one image of a product. When I look in the console it gives the following error: image

We haven't had this error before, I think after updating to Magento 2.4.3 this happend. I also updated to the latest version of your module but still the same error. When I disable your module the error is gone and more images are showing.

Do you have any idea how to fix this?

Kind regards,

Kylian

jissereitsma commented 2 years ago

Are you using a custom product gallery? Because this issue does not occur in a plain Magento environment (not with me anyway).

kylianleemkuil commented 2 years ago

Just looked in the list of modules and can't find any other module that would make a custom product gallery, nor in the theme we are using I see something of a custom product gallery. Here you can see the error yourself: https://www.labeldiscounter.nl/dymo-99012-s0722400-labels

jissereitsma commented 2 years ago

Thanks. Your RequireJS configuration shows that there are RequireJS mixins added on top of the mage/gallery/gallery.js library (https://www.labeldiscounter.nl/static/version1634212880/frontend/Comwrap/zolemba/nl_NL/requirejs-config.js): One belongs to this Webp2 extension. The other belongs the Fastly_Cdn module. Both mixins are targettting the same gallery, which is a UIComponent and not a jQuery widget or standalone JS function. That last statement is important, because a mixin for a UIComponent should have a different code than a mixin for a jQuery widget or a standalone JS function. For reference, https://devdocs.magento.com/guides/v2.4/javascript-dev-guide/javascript/js_mixins.html#format It seems that Fastly_Cdn is using the standalone JS function widget approach while actually they should have used the UiComponent approach. And through that, they make it impossible for any other extension to use the same mixin architecture. Put it really short, Fastly_Cdn is incompatible with any other third party extension extending the gallery on JS level. Unfortunately, it is not something I can fix :(

kylianleemkuil commented 2 years ago

Hi @jissereitsma ,

Thanks for the reply and the clear explanation why it isn't working. I made a ticket in the Fastly github and they apparently already had a fix and they are about to release it to master: https://github.com/fastly/fastly-magento2/issues/488#issuecomment-948464608 . So I think we can close this issue.

Thanks for the help and have a nice day. Kylian