How to disable JQMigrate Logging
In order not to overwrite any magento core files I just created a javascript file with this code
require(
['jquery'],
function ($) {
$.migrateMute = true;
$.migrateTrace = false;
}
);
I included the file in the head in default.xml
<link src="js/disable-jquery-migrate-warnings.js" />
I ended up overriding the core jquery-migrate
in our theme so I could set the migrateMute
option.
In my theme require-jsconfig.js
I set this override:
var config = {
paths: {
// disable jQuery migrate console output
'jquery/jquery-migrate': 'js/jquery-migrate'
}
}
Then copied the code jquery-migrate.js
file to the theme js
directory, and added this line towards the top:
// Set to true to prevent console output; migrateWarnings still maintained
jQuery.migrateMute = true;
One should mute jquery.migrate
before it gets initialised.
js/mute-migrate.js
requirejs(['jquery'], function ($) {
$.migrateMute = true;
$.migrateTrace = false;
});
requirejs-config.js
var config = {
paths: {
"mute-migrate":"js/mute-migrate"
},
shim: {
'jquery/jquery-migrate': ['jquery','mute-migrate']
}
}