Skip to main content

Some important command in Magento2 after you change the mode to production

From the Magento root directory, switch to production mode:

 bin/magento deploy:mode:set production

Enable JavaScript bundling:

 bin/magento config:set dev/js/enable_js_bundling 1

Optimize bundling by minifying JavaScript files:

 bin/magento config:set dev/js/minify_files 1

Enable cache busting on static file URLs. This ensures users get the latest version of the assets anytime they update:

 bin/magento config:set dev/static/sign 1

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

 bin/magento config:set dev/js/merge_files 0

Enable move JavaScript to bottom :

 bin/magento config:set dev/js/move_script_to_bottom 1

 

 

Deploy Static content for specific Theme

 php bin/magento setup:static-content:deploy --theme {Vendor}/{theme} en_US