Skip to content

Instantly share code, notes, and snippets.

@singingwolfboy
Created September 17, 2013 02:22
Show Gist options
  • Save singingwolfboy/6589357 to your computer and use it in GitHub Desktop.
Save singingwolfboy/6589357 to your computer and use it in GitHub Desktop.
require.js seems to be executing scripts out of order
define([], function() {
console.log("loading a");
return "module a";
})
define([], function() {
console.log("loading b");
return "module b";
})
<script src="require.js"></script>
<script>
require(["main"], function() {
console.log("this should run after main, a, and b are loaded");
});
</script>
require(["a", "b"], function() {
console.log("loading main");
});
@singingwolfboy
Copy link
Author

I would expect the log lines to print in this order:

loading a
loading b
loading main
this should run after main, a, and b are loaded

But I'm seeing behavior more like:

this should run after main, a, and b are loaded
loading a
loading b
loading main 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment