[Improvement] Bundle Config
See original GitHub issueAt this point, Magepack doesn’t support a custom config for bundles. Ideally, it’s needed to be able to define bundles as complex Magento builds have more spaces than CMS, Product, Category and Checkout. With the current config, all those custom pages will be broken which makes Magepack impossible to use on such builds.
I would add a config file where I would define bundles and URLs which are included to them like this:
magepack.config.json:
{
"bundles": {
"cms": {
// possibly other configs
"urls": [
"/homepage",
"/404"
]
},
"category": {
//...
},
"product": {
//...
},
"checkout": {
//...
}
}
}
As a result, the generate command would take baseUrl, httpAuthUser and httpAuthPass as a param.
The backend part (https://github.com/magesuite/magepack-magento) seems to be flexible enough to support custom bundles. Just need to adjust the generator.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:18
Top Results From Across the Web
bundle-config - - Set bundler configuration options
This command allows you to interact with Bundler's configuration system. Bundler loads configuration settings in this order:.
Read more >Bundling and Minification | Microsoft Learn
NET 4.5 to improve request load time. ... Open the App\_Start\BundleConfig.cs file and examine the RegisterBundles method which is used to ...
Read more >How do you get bundle config to use multiple build options?
In my case ( bundler-1.17.2 , bundler-2.0.2 ) it was passing all the arguments as one: $ bundle config --local build.openssl ...
Read more >One Weird Trick That Will Speed Up Your Bundle Install
This is a commonly used argument with bundle install to improve ... at least not with our default Rails/MRI setup, and that we're...
Read more >Improving JavaScript Bundle Performance With Code-Splitting
Improving JavaScript Bundle Performance With Code-Splitting ... on the project configuration and out-of-the-box framework features.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Alright, so I would like to summarize my take on this request.
First of all, we should be aware that preparing perfect bundles is not possible and there will most likely be modules that are loaded normally via RequireJS and for me that’s OK. The performance improvement of having most of them bundled is enough to get great results anyway.
That said, I think I am comfortable with making Magepack more configurable if somebody wishes to do so while preserving basing CLI usage for a nice baseline. My proposal would be to allow for the configuration that can be stored in the file in shape of:
That way you could:
'cms': null
in the config.The only issue I see, is that I think it would be best for this config to be named
magepack.config.js
and then Magepack would generate something likemagepack.bundles.js
with final bundling configuration so it would be a breaking change.Waiting for your feedback. I think I could tackle this enhancements somewhere around weekend or next week if everyone agrees.
@krzksz thank you for the replay 🙌
Let me show you my real-life example to show the case. On the website, we have a completely custom space called - gallery. It consists of the album listing and album view pages. This is absolutely true, there are using some of the general JS files (collected in the common bundle). However, the crucial JS logic on those pages is unique and includes only there, because it’s not needed on the product, category or CMS pages. Without having an ability to create a separate bundle for this page, I just end up breaking it.
The second possible case here is to create a homepage bundle. The performance of the homepage is usually a big deal from a lot of angles. For example, that would be suboptimal to include relatively heavy lightbox or slider which are not used directly on the homepage, but using somewhere on the about us, how-to or other possible CMS pages.
Just like with the homepage, it’s completely possible to have functionality that is even more valuable for the business than the checkout flow (like forms from where shop leads come from). Naturally, that would be good to have an ability to optimize it or at least keep working.
What do you think about the mentioned cases?
What if there would be a possibility to specify bundles as a list of pages to check with CMS-like collection logic? This doesn’t sound like adjustments which are far away from what we have right now.