From 247fbea07beec07e6fe2dce2b55720d285527049 Mon Sep 17 00:00:00 2001 From: Yonn Trimoreau Date: Mon, 8 Jan 2018 17:08:06 +0100 Subject: [PATCH 1/5] Fix for requireJS loading issues (for ad blockers) Please read https://github.com/magento/magento2/issues/12828 --- lib/web/mage/apply/main.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/web/mage/apply/main.js b/lib/web/mage/apply/main.js index 60b737e59e110..806927e623c5d 100644 --- a/lib/web/mage/apply/main.js +++ b/lib/web/mage/apply/main.js @@ -32,6 +32,9 @@ define([ } else if ($(el)[component]) { $(el)[component](config); } + }, function(error) { + console.error(error); + return true; }); } From 23a946b115aa57dfff7b7f066d48bcf9a366f3b5 Mon Sep 17 00:00:00 2001 From: Yonn Trimoreau Date: Tue, 9 Jan 2018 09:29:53 +0100 Subject: [PATCH 2/5] Fix code style issue + using consoleLogger --- lib/web/mage/apply/main.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/web/mage/apply/main.js b/lib/web/mage/apply/main.js index 806927e623c5d..3eb0da473275c 100644 --- a/lib/web/mage/apply/main.js +++ b/lib/web/mage/apply/main.js @@ -6,8 +6,9 @@ define([ 'underscore', 'jquery', - './scripts' -], function (_, $, processScripts) { + './scripts', + 'Magento_Ui/js/lib/logger/console-logger' +], function (_, $, processScripts, consoleLogger) { 'use strict'; var dataAttr = 'data-mage-init', @@ -32,8 +33,9 @@ define([ } else if ($(el)[component]) { $(el)[component](config); } - }, function(error) { - console.error(error); + }, function (error) { + consoleLogger.error(error); + return true; }); } From 62b4b6dda4c39cf8c42757b3de65f3c8819ff8b8 Mon Sep 17 00:00:00 2001 From: Yonn Trimoreau Date: Tue, 9 Jan 2018 12:45:03 +0100 Subject: [PATCH 3/5] Fix trailing whitespace + removed consoleLogger dependency --- lib/web/mage/apply/main.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/web/mage/apply/main.js b/lib/web/mage/apply/main.js index 3eb0da473275c..b387a89988d2f 100644 --- a/lib/web/mage/apply/main.js +++ b/lib/web/mage/apply/main.js @@ -6,8 +6,7 @@ define([ 'underscore', 'jquery', - './scripts', - 'Magento_Ui/js/lib/logger/console-logger' + './scripts' ], function (_, $, processScripts, consoleLogger) { 'use strict'; @@ -34,8 +33,8 @@ define([ $(el)[component](config); } }, function (error) { - consoleLogger.error(error); - + console.error(error); + return true; }); } From 7843395f45420ed83360ebd87ec4d4c62f7b976d Mon Sep 17 00:00:00 2001 From: Yonn Trimoreau Date: Tue, 9 Jan 2018 12:45:38 +0100 Subject: [PATCH 4/5] Forgot to remove function parameter for consoleLogger --- lib/web/mage/apply/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/apply/main.js b/lib/web/mage/apply/main.js index b387a89988d2f..1be4e041ded1b 100644 --- a/lib/web/mage/apply/main.js +++ b/lib/web/mage/apply/main.js @@ -7,7 +7,7 @@ define([ 'underscore', 'jquery', './scripts' -], function (_, $, processScripts, consoleLogger) { +], function (_, $, processScripts) { 'use strict'; var dataAttr = 'data-mage-init', From d826cb3efcef4f5cd7d4b63cfc1da23dbf0b5f01 Mon Sep 17 00:00:00 2001 From: Yonn Trimoreau Date: Tue, 9 Jan 2018 13:16:59 +0100 Subject: [PATCH 5/5] Added a check on window.console.error --- lib/web/mage/apply/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/web/mage/apply/main.js b/lib/web/mage/apply/main.js index 1be4e041ded1b..489e467f9b110 100644 --- a/lib/web/mage/apply/main.js +++ b/lib/web/mage/apply/main.js @@ -33,7 +33,9 @@ define([ $(el)[component](config); } }, function (error) { - console.error(error); + if ('console' in window && typeof window.console.error === 'function') { + console.error(error); + } return true; });