Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

sync requirejs('a') no longer works in 2.0 #271

Closed
jrburke opened this Issue · 0 comments

1 participant

@jrburke
Owner

In a node program:

var requirejs = require('requirejs'),
    foo = requirejs('foo');

where foo is an AMD module, this will give an undefined value for foo. This is because req.get() defined in build/jslib/node.js does a load() call, but then does not enable the module, so that it finishes execution.

This is a result of the "do not execute define() factory functions until explicitly required" change in 2.0, and it looks like this pathway was just missed in 2.0.

The fix seems to be to call context.enable(moduleMap, relModuleMap) after the req.load() call in req.get().

First reported in this gist: https://gist.github.com/3455313

@jrburke jrburke closed this in bca9cf0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.