-
Notifications
You must be signed in to change notification settings - Fork 28
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
Mixins are not applied for bundled modules #23
Comments
Thanks for reporting this! I was able to replicate most of the behavior. The mixins do get bundled correctly for me (we discussed a bit in Slack), but you're 100% correct that they're not executing, and that is bad. Trying to free myself up a bit to work on a fix. |
Ok, after some hacking around I was able to come up with the form of |
Spoke a bit offline, and @krzksz is going to take a stab at fixing this 🎉 |
@krzksz Had some time to look into your solution tonight - that is super clever! I definitely had not thought of using a separate context for lookups! I've been playing around a bit with an idea where we could basically compile away mixins and just not need to load I'm going to dig around a bit more and see if we have any more straight-forward options, but my guess is that you've found the most reasonable option. Will follow-up with how we might want to go about landing your changes. We'll obviously want to fix this in core, but we may want to teach |
@krzksz might even be worth getting a PR to core started up so you can run the test suite (we can always clean up or refactor in the PR) |
I'm eager to try Baler, but lack of mixins support is a deal-killer for me. Any update on a fix for this? |
@erikhansen There is an open PR to core to address the bug in |
@krzksz You're an absolute champ and a lifesaver. Thanks so much. |
I have turned the above PR into a patch here: https://github.com/integer-net/magento2-requirejs-bundling |
Hi. I just try to use it fix for magento 2.3.4, but seems it is works rather strange - it is works only for mixins that defined in date-mage tags and processed by main.js script. But if you add mixin,which using only in javascript module, this is never appy. Do all mixins work for you ? |
Hey @galillei, Did you get to the bottom of this? Not sure we're seeing this exact issue but we are seeing strange behaviour on 2.3.4 where a js module just isn't initialising, despite loading and getting defined in an existing bundle |
Hey @edward-simpson |
Hi @jtomaszewski. Based on the above maybe a patche is not needed |
Hey! First of all I need to say that I'm really impressed with the performance of this solution an ease of use in relation to other tools which take advantage of headless browsers etc., great work!
Unfortunately, when I gave baler for a spin it seems like we hit the same obstacle that I did and documented under https://github.com/magesuite/magepack#modules-with-mixins-defined-cannot-be-included-in-a-bundle
The issue comes from mixins.js file and its
processNames
method which is (as far as I understand) responsible for prepending given modules' names withmixins!
prefix in case certain module has any mixins defined for it so that they can be applied when it is loaded. The problem is that in order to get a path for said module,getPath
is called, which then callsrequire.toUrl
. Multiple calls later we land inside require'snameToUrl
method:As you may have figured out, for each of our modules that were included in core bundle we are getting
balerbundles/core-bundle
instead of the actual name. Because of the fact that stock Magento makes use of mixins, even for providing jquery security patches I would say this issue is critical and should be addressed ASAP before anyone uses this solution in production.There are 2 possible ways this can be solved:
mixins.js
bundling-aware by reimplementing wholetoUrl
tonameToUrl
chain so that it doesn't haveif (bundleId) {
check in it.That's all that I can see right now, I'll try to hack around a bit to see what the simplest route would be.
The text was updated successfully, but these errors were encountered: