diff --git a/cms/templates/container.html b/cms/templates/container.html
index 0062d91628..4ae77e6601 100644
--- a/cms/templates/container.html
+++ b/cms/templates/container.html
@@ -32,19 +32,18 @@ main_xblock_info = {
diff --git a/cms/templates/edit-tabs.html b/cms/templates/edit-tabs.html
index 1c5adf846c..bc1a4294ae 100644
--- a/cms/templates/edit-tabs.html
+++ b/cms/templates/edit-tabs.html
@@ -21,16 +21,18 @@
diff --git a/cms/templates/unit.html b/cms/templates/unit.html
index 4ed9e5ba2a..f28075a1ca 100644
--- a/cms/templates/unit.html
+++ b/cms/templates/unit.html
@@ -21,25 +21,27 @@ from django.utils.translation import ugettext as _
<%block name="jsextra">
diff --git a/common/djangoapps/pipeline_js/templates/xmodule.js b/common/djangoapps/pipeline_js/templates/xmodule.js
index 4dedffd04a..4004342145 100644
--- a/common/djangoapps/pipeline_js/templates/xmodule.js
+++ b/common/djangoapps/pipeline_js/templates/xmodule.js
@@ -21,8 +21,17 @@ define(["jquery", "underscore", "mathjax", "codemirror", "tinymce",
var urls = ${urls};
var head = $("head");
- $.each(urls, function(i, url) {
+ var deferred = $.Deferred();
+ var numResources = urls.length;
+ $.each(urls, function (i, url) {
head.append($("", {src: url}));
+ // Wait for all the scripts to execute.
+ require([url], function () {
+ if (i === numResources - 1) {
+ deferred.resolve();
+ }
+ });
});
- return window.XModule;
+
+ return deferred.promise();
});