0

Magento version 2.1.9

Trying to deploy the website results in strange JS and CSS errors.

With the configuration of:

dev/js/merge_files = 0
dev/js/enable_js_bundling = 0
dev/js/minify_files = 0
dev/css/merge_css_files = 0
dev/css/minify_files = 0

Results in a pub static folder without minified/bundled files (without a _cache folder in the pub static), which is supposed to work fine. However, Magento is still looking for a bundled JS file (404 error in the console looking for a JS file in the pub/static/_cache/merged folder)

With this configuration:

dev/js/merge_files = 1
dev/js/enable_js_bundling = 1
dev/js/minify_files = 1
dev/css/merge_css_files = 1
dev/css/minify_files = 1

There should be a folder + file be created in /pub/static/_cache/merged, but these arent created.

All permissions are set properly and no errors are being logged.

1 Answer 1

1

Minifying and merging js and css can improve load times and general performance of your store, so it should be enabled in production mode, but if you have to do any kind of development then you should not enable it.

In production mode the developer tab in admin store configuration in removed so you have to manually enter values in db to enable and disable them.

Following are the fields you need to set 0 or 1 in core_config_data table to disable/enable these settings;

dev/js/merge_files  - Merge Js
dev/js/minify_files - Minify Js

dev/css/merge_css_files - Merge css
dev/css/minify_files - Minify css

You can also choose to bundle js files, which would reduce the number of requests done to site to improve load times by setting following ;

dev/js/enable_js_bundling - Bundle Js Files

Do not forget to deploy your static content and flush cache using following commands after modifying any of these fields;

php bin/magento setup:static-content:deploy
chmod 777 -R var pub generated
php bin/magento cache:flush

(fixed code formatting)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.