문제

Is

define(['a', 'b'],
   function(require, exports, module) { } );

equivalent to this

define(function(require, exports, module) { 
      require(['a', 'b'])
});

If not, how is it different?

도움이 되었습니까?

해결책

Your first bit of code should actually be

define(['a', 'b'], function(a, b) { } );

and the second bit as

define(function(require, exports, module) { 
    var a = require('a');
    var b = require('b');
});

When you use the second bit of code requirejs has to parse the function.toString() to find the require statements and add them as a dependency.

http://requirejs.org/docs/api.html#define

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top