8000 Is this abandoned? · Issue #73 · magento/baler · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Is this abandoned? #73

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

Closed
PivitParkour94 opened this issue Nov 24, 2020 · 12 comments
Closed

Is this abandoned? #73

PivitParkour94 opened this issue Nov 24, 2020 · 12 comments

Comments

@PivitParkour94
Copy link

After spending some time to get this up and running locally, found that the only bundle created was the <theme>/balerbundles/core-bundle.js

Did some digging and found this document, which seems to imply other solutions should be used instead https://github.com/magento/baler/blob/master/docs/WHY_CUSTOM.md#how-are-folks-working-around-this-today

  • hand rolling requirejs optimization config file
  • magepack
  • other similar options..

I just want to know for definite that this repository is not the intended way to do things.

Is that correct? Or am I missing something here?

@PivitParkour94
Copy link
Author

Related issue #70

@PivitParkour94
Copy link
Author
  1. Hand-rolling configuration for the RequireJS optimizer (similar to Advanced Bundling docs)
  2. Using WeareJH/config-gen to generate a config for the RequireJS optimizer
  3. Using magento/m2-devtools to generate a config for the RequireJS optimizer
  4. Using magesuite/magepack to generate a config for the RequireJS optimizer

The problem with all of the suggested solutions, is that they require an existing Magento store to already be running to determine the requirejs dependency graph etc. The promising feature of using baler is it determines the requirejs dependency graph using the existing code of the theme, requirejs-config.js and other *.phtml files, which means "baling" can be a part of a CI pipeline for getting a fast magento 2 frontend, until you use PWA's which makes it all obsolete anyway.

@digiltd
Copy link
digiltd commented Nov 24, 2020

Sadly I think it has been abandoned, it has now been removed from the docs magento/devdocs#7876

Improving performance on Magento is hard, the javascript situation is "a bit of a mess" (a very polite understated version of how I want to describe it).

Not helped by the contradicting documentation, the place where you should be able to get definitive answers on how things work is all over the place.

https://devdocs.magento.com/guides/v2.4/performance-best-practices/advanced-js-bundling.html#magento-merging-and-bundling says:

Basic merging
This command merges all synchronous JavaScript files into one file. Enabling merging without also enabling bundling is not useful because Magento uses RequireJS. If you don’t enable bundling, Magento only merges RequireJS and its configuration. When you enable both bundling and merging, Magento creates a single JavaScript file:

Sounds good. But 8000 on this page https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/themes/js-bundling.html you are told:

To configure JavaScript bundling, you must disable Javascript file merging. Bundling will not work as the merging of files excludes bundling:

Hmmm, ok but it still does say to use the minify and inbuilt bundling features. So that's good.

Enable JavaScript bundling:
Optimize bundling by minifying JavaScript files:

You are also told to minify and bundle on https://devdocs.magento.com/guides/v2.4/performance-best-practices/configuration.html#client-side-optimization-settings but futher down the page you are told:

Magento built-in mechanisms are not optimal and are shipped as fallback alternatives.

and

We do not recommend using deprecated settings like merging JS and CSS files, as they were designed only for synchronously-loaded JS in the HEAD section of the page. Using this technique can cause bundling and requireJS logic to work incorrectly.

image

🤦

@Quazz
Copy link
Quazz commented Nov 25, 2020

I still use baler on Magento 2.4

I forked the magento module to include PHP 7.4 as supported.

Baler is unfinished, but the core-bundle is javascript that is loaded on each page and can thus be safely bundled without needing to worry about dependency graphs.

The next step would be for baler to generate dependency graphs for pages so that the javascript downloads get initiated much faster and thus improve page load, but since development seems to be paused, that seems unlikely to happen any time soon.

Other tools don't really seem to provide better outcomes in my experience, some of them providing even worse performance than default js delivery. Of course on second page load they perform way better, but that isn't useful for drawing in new customers and it's not useful for Search Engines that check your pagespeed.

@PivitParkour94
Copy link
Author

@Quazz the way you're using it is good, for setting up individual stores, but when we're doing agency type work and have 5-10 stores to setup, using the baler for each store becomes very tedious and hard to automate. It would be awesome if this project continued to grow, but at the moment it seems to be very stale. Obviously with PWAs the project then becomes obselete. I suppose this is just another thing that is forgotten about between the stores running M2.x with themes and the new shiny PWAs.

Just with this repository still being in docs and things it becomes a little confusing when trying to figure out the "right" solution before the jump to PWAs.

It seems core is simply saying "Go to PWAs", so I guess that's what we have to do. I'll close this

@rossmc
Copy link
rossmc commented Dec 4, 2020

Hi @PivitParkour94

Regarding the below, magepack v2 does this, and we run it in our pipeline.

The promising feature of using baler is it determines the requirejs dependency graph using the existing code of the theme, requirejs-config.js and other *.phtml files, which means "baling" can be a part of a CI pipeline for getting a fast magento 2 frontend, until you use PWA's which makes it all obsolete anyway.

It has to be magepack v2 to run in the pipeline, it won't work with magepack v1.

Magepack 2 uses a custom bundler based on Baler.
Check out https://youtu.be/ahxoTedqHjw.

You need v10+ of node in your CI pipeline for it to work.
You still need to generate the magepack.congfig.js locally, but the bundles can be generated in the pipeline line. The magepack.config.js rarely needs to be updated.

@frno-morita
Copy link
frno-morita commented Apr 26, 2021

I will leave a short summary of my thoughts and tricks to achieve good FE-performance in the current Magento 2 frontend; and let me tell you, Magento 2 FE CAN be very fast without having to go down the road of Venia/Vue Storefront etc.

What are the main problems with the base Magneto 2 frontend:

  • Lazy loading of images are not used
  • Until just recently Magento 2 have not made use of preload functionality to preload most essentials resources (this also should be configured from project to project to achieve best results)
  • Magento 2 JavaScript initialization techniques are unfortunately bound to ALL execute at DOM Ready (pretty much); this leads to long running JavaScript execution which competes with other important event in the Browser Event Loop (Layout, Paint, Parsing, input recognition etc. etc.).

Lazyloading

Native lazy loading is now available, but according to our experience it still does not help FE performance much (this could very well change in the near future where Native Lazy Loading could be the best way to approach this) and an eager approach is better for above-the-fold images while the rest of images should be loaded with for example lazysizes lazysizes Git

Preload

Magento 2 does not make use of "new" preload techniques Preload resources article. It is not good to preload too much stuff, but things like:

  • CSS (styles-m.css, styles-l.css)
  • Fonts
  • require.js, requirejs-config.js and mixins.js should be preloaded

Magento 2 JavaScript initialization issues

To let the browser "breathe" it is worth looking into the concept of an Idle Queue, take Google's implementation as a reference point: idlize.

Another thing to take a look at is using the Browser Cache API or ServiceWorkers to leverage better caching in the browser; either of these is one of the things needed by the PWA specification (you don't need React, Vue or Venia to be a PWA). See Google's advices on how to make you page faster for example using PRPL pattern: Apply instant loading with the PRPL pattern

Summary

None of the above are really "low-hanging fruits" so to say since each of them usually needs specific tweaking for each site since all sites are different, but I hope I shared some interesting insights from our experience.
We still use Baler to much success but it should be used with the above stuff to really speed a Magento 2 page up to 95-100 score in Lighthouse.

@digiltd
Copy link
digiltd commented Apr 29, 2021

We still use Baler to much success but it should be used with the above stuff to really speed a Magento 2 page up to 95-100 score in Lighthouse.

@frno-morita 🤨 such a thing (a Magento 2 si 8000 te with a score of 95-100) doesn't exist :)

@woutersamaey
Copy link

@digiltd yes it exists. Check out the recently released hyva.io
It's a radically different approach, but we love it.

@digiltd
Copy link
digiltd commented Apr 29, 2021

@woutersamaey indeed, though that is essentially redoing everything that Magento "provides" in terms of js, layout, templates etc. I applaud @wigman for what he has done, but it was a massive task and ditches everything frontend that Magento provides, but I think realistically, it was the only way :)

@woutersamaey
Copy link

@digiltd Exactly. I can only recommend this route. You'll never need to consider anything like Baler or otherwise.

@tr33m4n
Copy link
tr33m4n commented Apr 29, 2021

@digiltd @woutersamaey And don't forget of course Magento's own PWA studio https://github.com/magento/pwa-studio ... We're using that commercially and it's working well so far

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
0