Skip to content

Instantly share code, notes, and snippets.

@rlidwka
Created February 25, 2012 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlidwka/1910148 to your computer and use it in GitHub Desktop.
Save rlidwka/1910148 to your computer and use it in GitHub Desktop.
define('test', {
task1: function(cb) {
require('dep', function() {
// do smth
cb();
});
},
});
@millermedeiros
Copy link

I would write like this:

//list require as a dependency so relative paths works properly
define('test', ['require'], function(require){

    return {
        task1: function(cb) {
           // since it's a dynamic require dependency should be an array
           require(['dep'], function(dep) {
              // do smth
              cb();
           });
        }
    };

});

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