Dynamic require in RequireJS, getting “Module name has not been loaded yet for context” error?

The limitation relates to the simplified CommonJS syntax vs. the normal callback syntax: http://requirejs.org/docs/whyamd.html#commonjscompat https://github.com/jrburke/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define Loading a module is inherently an asynchronous process due to the unknown timing of downloading it. However, RequireJS in emulation of the server-side CommonJS spec tries to give you a simplified syntax. When you do something like this: var foomodule … Read more