Is the following possible with RequireJS?
Module A:
define([
'moduleB'
], function(moduleB){
// log moduleB exports
console.log(moduleB);
// exports
var moduleA = {};
// set a var to export
moduleA.varA = 'This is a variable in module A';
// return exports
return moduleA
});
Module B:
define([
'moduleA'
], function(moduleA){
// log moduleA exports
console.log(moduleA);
// exports
var moduleB= {};
// set a var to export
moduleB.varB= 'This is a variable in module B';
// return exports
return moduleB
});
http://requirejs.org/docs/api.html#circular
The short answer - you can, but should not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With