-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Video) Calling jarallax-wrapper and loading on demand librairies #865
base: develop
Are you sure you want to change the base?
Conversation
I needed to replace jarallax with jarallax-wrapper to make it work with a custom Js bundler (Magepack Bundle) Indeed, without jarallax-wrapper, window.jarallax is not populated and return an error (undefined var). I take advantage to this commit to suggest to load on demand librairies (jarallaxVideo, vimeoWrapper) after the check of the data background-type.
@magento run all tests |
Hello @Amadeco, Thanks for the contribution! We request you to please provide us with some more details on the replacement of Thanks |
Hello, At the time, I was using a bundler for production (https://github.com/magesuite/magepack) to manage JavaScript files. This issue is isolated to that setup. When I compiled the files, the jarallax object was not defined, likely due to a context issue or the way the bundler handles modules (specifically, the order of the JS files). Magento provide the jarallax-wrapper module to call the jarallax class and attach it to the window (global) object, which is why I submitted this issue in the first place to solve mine. But the ways the requirejs-config file is declared (shim), Magento_PageBuilder/js/resource/jarallax/jarallax-video would be sufficient :
(it would be great to load vimeoWrapper and vimeo only on demand too) Nowadays, with HTTP/2 and HTTP/3, bundlers are not always ideal for frontend performance which generate big JS files. It's up to you to decide whether addressing this is still relevant. |
@magento create issue |
Hello @Amadeco, Thanks for the detailed explanations! It seems the issue occurs due to the third-party extension i.e. https://github.com/magesuite/magepack not from the core Magento 2. We request you to please use the default Magento's JS Bundler: https://developer.adobe.com/commerce/frontend-core/guide/themes/js-bundling/ And let us know if you are still able to reproduce the issue. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Amadeco,
Thanks for the detailed explanations!
It seems the issue occurs due to the third-party extension i.e. https://github.com/magesuite/magepack not from the core Magento 2. We request you to please use the default Magento's JS Bundler:
https://developer.adobe.com/commerce/frontend-core/guide/themes/js-bundling/
And let us know if you are still able to reproduce the issue.
Thanks
Hello @Amadeco, Have you had a chance to look into this #865 (review)? Thanks |
I needed to replace
jarallax
withjarallax-wrapper
to make it work with a custom Js bundler (Magepack Bundle) Indeed, withoutjarallax-wrapper
,window.jarallax
is not populated and return an error (undefined var).I take advantage of this commit to suggest to load on demand librairies.
Resolved issues: