Skip to content

Commit bf705b0

Browse files
Chhandak.BaruaChhandak.Barua
authored andcommitted
ACP2E-2045: JS jQuery mix-in files not loading Intermittent issue
1 parent 2894e5e commit bf705b0

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

app/code/Magento/RequireJs/Block/Html/Head/Config.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ protected function _prepareLayout()
129129
$requireJsConfig,
130130
$after
131131
);
132-
$after = $requireJsConfig->getFilePath();
133132
$requireJsMixinsConfig = $this->fileManager->createRequireJsMixinsAsset();
134133
$assetCollection->insert(
135134
$requireJsMixinsConfig->getFilePath(),

lib/web/mage/requirejs/mixins.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ define('mixins', [
66
'module'
77
], function (module) {
88
'use strict';
9-
109
var contexts = require.s.contexts,
1110
defContextName = '_',
1211
defContext = contexts[defContextName],
13-
unbundledContext = require.s.newContext('$'),
12+
unbundledContextName = '$',
13+
unbundledContext = contexts[unbundledContextName] = require.s.newContext(unbundledContextName),
1414
defaultConfig = defContext.config,
1515
unbundledConfig = {
1616
baseUrl: defaultConfig.baseUrl,
@@ -205,7 +205,10 @@ require([
205205
var contexts = require.s.contexts,
206206
defContextName = '_',
207207
defContext = contexts[defContextName],
208+
unbundledContextName = '$',
209+
unbundledContext = contexts[unbundledContextName],
208210
originalContextRequire = defContext.require,
211+
originalContextConfigure = defContext.configure,
209212
processNames = mixins.processNames;
210213

211214
/**
@@ -219,6 +222,15 @@ require([
219222
return originalContextRequire(deps, callback, errback);
220223
};
221224

225+
/**
226+
* Wrap original context configuration to update unbundled context,
227+
* that way it is able to respect any changes done after mixins module has initialized.
228+
*/
229+
defContext.configure = function(cfg) {
230+
originalContextConfigure(cfg);
231+
unbundledContext.configure(cfg);
232+
}
233+
222234
/**
223235
* Copy properties of original 'require' method.
224236
*/

0 commit comments

Comments
 (0)