Magento2: Combining JS, Merge JS, Minify JS

Created on 16 Dec 2015  Â·  56Comments  Â·  Source: magento/magento2

Hello everyone,

using the features to combine, merge and minify JS files in the Magento Backend, causes javascript errors, which leads to the problem, that the admin menu won't slide out.

http://magento/pub/static/version1450257641/adminhtml/Magento/backend/de_DE/requirejs/require.min.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://magento/pub/static/version1450257641/adminhtml/Magento/backend/de_DE/mage/requirejs/mixins.min.js Failed to load resource: the server responded with a status of 404 (Not Found)

How may I disable this seemly buggy feature?

Thank you in advance.

Kind regards

Chris

Cannot Reproduce Clear Description Format is not valid

Most helpful comment

@waynep16, you are using wrong SQL query. Try this one:
SELECT * FROM core_config_data WHERE path LIKE '%js%' LIMIT 0 , 30

All 56 comments

@ci2014 I reported this problem a long time ago but they weren't able to reproduce it
https://github.com/magento/magento2/issues/1203

@craigcarnell Thank you for referencing. I hope we will figure something out.

I disabled it via phpmyadmin in the table core_config_data, setting nearly all "paths" containing "merge" and "minify" in their names to 0, but left dev/template/minify_html 1, because this is not causing any problems. We should not ignore this bug though.

Hello, @ci2014

Is this issue still reproducible on latest developer branch?
Please, provide more details about your evironment: Server, OS, browser version

Closing due to lack of reply from OP

I have this issue now with the latest build. It happens after i enabled merging and minifying js files in the admin. but the moment i cant go back as all js is broken because of the 404 error of mixins and require.min,.js

We're running into the same issues... Fresh instance, fresh composer installation(2.0.5).
Luma OOB settings.

After setting the js merge+bundle+minify config and deploying static files, the front- and backend doesn't respond anymore, cause hhvm or php7fpm (or php whatever) processes are going up to 100%+ cpu which results in a partially frozen service. The process rests even 2min in space before it does stop after firing the the stop service from the cl. After stopping the service the fallback php7-fpm comes in, with the same results in our case.

We've to stopped the services by killing the pid's, re-edit the core_config_data and redeploy the static files. Clean all cache related and generated/static/di stuff. Restarted all services, but still we're getting 504 time-outs from one of our php backends.

Edit: Css minification was still set to 1 in core_config_data, after disabling and doing the same procedure as described above we're back in dev biz.

Short setup overview
HAProxy(SSL) -> Varnish 4 -> Nginx -> HHVM with fallback to PHP7.0-FPM

I can confirm I've got this problem (gewaechshaus) too. Quick fix available?

Thanks, will keep an eye out for those threads as well.

This is still an issue, and i cant find anything in the DB related to minification in order to disable it !

all i see in core_config_data is

screen shot 2016-05-10 at 23 08 44

NOTHING about JS or CSS minifying at all

now stuck with a broken admin area and slow shop that does nothing

@waynep16 - you are at the wrong page, try to use pagination in phpmyadmin...Core_config_data does contain more than 13 records for sure ;) You can also click the search button at the top while viewing the related table. Search in the path field for something %like% js css and so on.

Nope - we are using latest magento and there are only 13 records when i click in to Core_config_data with no pagination to advance to another...

MySQL returned an empty result set (i.e. zero rows). (Query took 0.0005 sec)
SELECT *
FROM core_config_data
WHERE path LIKE 'js'
LIMIT 0 , 30

@waynep16, you are using wrong SQL query. Try this one:
SELECT * FROM core_config_data WHERE path LIKE '%js%' LIMIT 0 , 30

Still nothing with that query

MySQL returned an empty result set (i.e. zero rows). (Query took 0.0005 sec)

maybe the install didn't complete properly? even though its working (minus the admin panel not working due to this JS issue which i cant disable because i cant find the DB table)

See attached.

image

@waynep16, i have clean installation, do enable js merging, bundling and minifying and have this in DB:
screen shot 2016-05-12 at 2 54 48 pm
So, if it works for you, maybe you are checking wrong DB? :)

In the correct db of cours. I CHMODed all files in pub folder which were incorrect and now the admin interface loads but still doesn't click or do any JS effects.

If anyone wants to see via Skype I'll happily show

go6_media

This DB entries are missed by default. Only after you go to Admin->Developer and save this section, they have to appear.

Thanks @shiftedreality for clearing that up and showing im not stupid lol

Problem is I can't go to admin / Dev and save the page because JS and the back end doesn't load due to the initial problem ! So I can't do anything. Stuck

What if manually insert this settings into table?

If someone can give me the query to run to add them all lol

On 2.0.8, this just happened to me.
SELECT * FROM core_config_data WHERE path LIKE '%js%' LIMIT 0 , 30 worked for me. Changed the values and emptied var/cache to regain access to admin interface.

I'm spending more time tracking down Magento bugs than working on the site.

I have the same issue on a fresh 2.1 install with composer. Most likely the combination of merging and minifying JS is creating an issue here, a link to a non existing minified file due to merging.

EDIT: The problem seems to be the minifying, just disabling merging/combining js wasnt enough.

had same issue, just do php bin/magento setup:static-content:deploy

Change to developer mode - this disabled the bundling which seems to be causing the issue.
Once in developer mode, change the settings in Developer > Javascript Settings

Experiencing same issue. There currently is no solution for this, right? The last few comments seem to show how to regain access to the admin only.
Magento 2.1.2

Just experienced this on 2.1.2 also, using static deploy as @erikkubica suggested worked.

@jupiter01 Doesn't work here
@caseyjonesaustralia Change to developer mode - this disabled the bundling which seems to be causing the issue.
Is not really a solution for a production environment?

Re-deploying the static files only allowed me to regain access to the admin console. There still were issues with the frontend that kept occurring until I turned this feature off. I wouldn't suggest trying to use it in a production environment as It broke the store I was working on.

@jupiter01 I'm running a Magento 2.1.2 installation as well and was able to fix the access to the admin, just as you have.

Are there any specific issues you have run into on the front end while keeping Minify JS and Merge JS on? It appears as though the newsletter popup, after signing up, has created a slight problem on my end and the newsletter window persistently pops up after subscribing, even with cookie enabled.

Trying to debug through using multiple options, and the first problem I had started with Minify HTML #4365

I've been going through the JS options, however I'm not a developer. I know the Bundling of JS causes large files and extremely slow loading, but I have not seen any other Merge and Minify JS problems.

The problem do exist in 2.1.5 as well, any idea when this is going to be resolved?

Reopening for processing by GitHub watchers.

we've just had a version of this issue after an upgrade from 2.1.5 to 2.1.7 - we have always had minify js files set to yes without issue. Today the client was unable to load the wysiwyg editor anywhere in admin. Looking at console, we were getting errors about mime types. With minify disabled it all works fine again.

To second @tomdollarmpd: In 2.1.7 (a clean install), minification of both JS and CSS breaks the assets, in production mode.

Same problem here guys on a fresh install pn php7.0. Funny thing is, the error is only happening on SSL pages. The issue does not occur on the development server (which sits on a sub domain without SSL and its an exact replica of the live site). Only the live site with the SSL is having issue with the minify JS and CSS enabled. The bug is real.

I met the same problem. php bin/magento setup:static-content:deploy work for me. @erikkubica Thank you!

Have same issue on 2.1.7 and php 7.0. Some files found, some not

default

Hi there, I had the same issue and I did what @erikkubica said, it works fine!. But you have to keep in mind that if you have your store in other languages for example pt_BR witch is my case, you will have to do:
php bin/magento setup:static-content:deploy pt_BR (or your language).

@rafatriolo Didn't work for me with 6 different shops

Have cleared the cache and reindex all indexes? One more thing, have you switched to the production mode?

@rafatriolo yes, of course (even did setup:upgrade and recompile and all, nothing seems to fix it), i disabled minify cause then it breaks...

I will check this out to see if I find another answer. Tks for sharing!

@Shade634 I just realize that you have multistores, would you check this article : https://magento.stackexchange.com/questions/117637/js-and-css-merged-issue-in-magento2
see the last post. I hope it helps you.

@rafatriolo I have tried this without any result, my temporary solution:

Merge javascript files: Yes
Enable javascript bundling: Yes
Minify javascript files: No

It might have to do with other extensions as well even though it does not load a core backend script. (does not exist)
There is no need to keep this issue open for just me. :)
I think it would help if people that have this issue, would also report if they have, and which extensions/templates they are using so we can make it reproduce able.
I have not tried this on a clean magento installation.

just set dev/js/minify_files to 0 in core_config_data table and run bin/magento cache:flush again you admin menu will work again

@kielsoft Then you disable minify again, its the only way to get your site working again, but not a fix. So far i havent had a moment to try this on a clean install.

@ci2014, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
We tested the issue on 2.3.0-dev, 2.1.10, 2.2.1

@magento-engcom-team Thank you. At the moment, I don't have this problem anymore.

I still have this problem on a fresh 2.2.2 install, proposed solutions/workarounds did not work for me.

@streamholder Did you test this without any installed 3rd party extensions or templates? (I havent tried this so far).

Yes. Clean install.
I noticed that changing the “mode” to “production” fixes it.

Da: Jeroen Silvius [mailto:[email protected]]
Inviato: giovedì 15 febbraio 2018 16:42
A: magento/magento2 magento2@noreply.github.com
Cc: Riccardo Paolo Bestetti riccardo.kyogre@live.it; Mention mention@noreply.github.com
Oggetto: Re: [magento/magento2] Combining JS, Merge JS, Minify JS (#2732)

@streamholderhttps://github.com/streamholder Did you test this without any installed 3rd party extensions or templates? (I havent tried this so far).

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/magento/magento2/issues/2732#issuecomment-365965905, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AB3WqRZgBDDlm2yy6_1O2dwDnKEGhcD6ks5tVFA1gaJpZM4G2XNX.

I had the same issue after minify js from admin, admin menu and cache management was not working.
To fix this, I performed the below steps.
1) Search "dev/static/sign" in core_config_data table, if its value is 1, update it to 0.
2) After updating run the static content deploy and flush the cache.

After doing this, you will not face the same issue when unminify/minify js from admin again.

Thanks.

I get similar issues. When combining javascript, it ends up erroring out and doesn't allow require.js to fully import all that is needed so any libraries that would have been loaded later in the page-load aren't there producing still more errors. The most significant thus far is that the CookieLaw code isn't loaded so once the pop-up appears, you can't dismiss it as the button is tied directly to a object-method call that isn't defined.

We encountered this error, and the issue was that the minifier couldn't recognize _comments_ in this shape so it left it as it was and this was causing issues in our js file and lead to an error , we _fixed_ it by just changing the comment from