title: require a local module in requirejs optimizer's callback
body: <pre><code>function test(){
      //optimize operation
      requirejs.optimize(profile, function(){
          //success callback
          //require local module hehe
          requirejs.config({
              baseUrl: 'scripts'
          });
          var nice = requirejs('hehe');
          console.log(nice);  
      }
      , function(err) {
          //failure operation
          console.log(err);
  })};
  </code></pre>
  
  <p>I run requirejs in nodejs environment.(r.js)</p>
  
  <p>It seemed that I could not get the module 'hehe' in the callback. The right output of console should be '2', while the current output is 'undefine'</p>
  
  <p>But if I put the requirejs(...) var nice;console.log(nice) out of the callback. The output is correct.
  The problem seemed to be related with the context in the requireJS.</p>
  
  <pre><code>function test（）{
  requirejs.optimize(profile, function(){
      //success callback
      },
      function(err){
      console.log(err);
      }
  );
  requirejs.config({
      baseUrl : 'scripts'
  });
  var nice = requirejs('hehe');
  console.log(nice);}
  </code></pre>
  
  <p>And it confuses me that even if I put them out of callback , problem still exists when I use test() in gulp watch.</p>
  
  <pre><code>gulp.task("build", function(){
      test();
  }):
  gulp.task("watchsrc",function(){
      gulp.watch('*.js',['build']);
  });
  </code></pre>
  
  <p>When I run gulp watch and modify src js file. At first time it works, console output is 2. But when I modify file the second time, the result becomes undefined again.</p>