Stratus Magento 2 Guides - Using Baler to Speed Javascript Delivery
The result of this bundling is faster page speed times, which can improve customer experiences and Google rankings.
Bundling can only be activated on a Production environment.
Installing Baler
To install Baler:
Clone the current Baler Repository.
git clone https://github.com/magento/baler.gitChange to the Baler directory and install using npm.
npm installCheck to confirm you have node.js version 10.12.0 or later.
~/baler/bin$ ./baler baler requires a version of node.js >= 10.12.0. You're currently using v8.16.0For more on using node.js, see Node.js Node Version Manager .
Change to the Magento 2 document root and run Baler.
:~/public_html$ /srv/baler/bin/balerClear Magento and Redis cache.
~/public_html$ n98-magerun2 cache:clean~/public_html$ n98-magerun2 cache:flush~/public_html$ redis-cli flushallInstall the Magento 2 module that will handle bundlings.
composer config repositories.baler vcs https://github.com/adifucan/m2-balercomposer require magento/module-baler:dev-masterActivate module.
n98-magerun2 module:enable Magento_BalerRun deployment process.
n98-magerun2 setup:upgraden98-magerun2 setup:di:compilen98-magerun2 setup:static-content:deployClear Magento and Redis cache again.
~/public_html$ n98-magerun2 cache:clean~/public_html$ n98-magerun2 cache:flush~/public_html$ redis-cli flushallRun the set configuration command.
php bin/magento config:set dev/js/enable_baler_js_bundling 1Run Baler again.
$ /srv/baler/bin/baler buildDisable builtin Magento 2 javascript minification, merging, and bundling.
php bin/magento config:set dev/js/minify_files 0php bin/magento config:set dev/js/enable_js_bundling 0php bin/magento config:set dev/js/merge_files 0Clear Magento and Redis cache yet again.
~/public_html$ n98-magerun2 cache:clean~/public_html$ n98-magerun2 cache:flush~/public_html$ redis-cli flushall
Last modified on June 3, 2026