The logic we're using to create a script tag was based on jQuery's script transport:
script = document.createElement( 'script' ); script.src = VARS.baseModulesUri; script.onload = script.onreadystatechange = function () { if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) { // Clean up [..] // Callback startUp();
It seems this is getting dated and I'm not sure why, but I think reducing it to just this would help:
script = document.createElement( 'script' ); script.src = VARS.baseModulesUri; script.onload = function () { // Clean up [..] // Callback startUp();
Which is what jQuery 3.x does as well.