I've done a test here and was able to find a solution. What you have is equivalent to this JavaScript:
define(function (require) {
This is enough to be able to use the (fake) synchronous form of require
. However, RequireJS will give you the error you got when you try to use a synchronous require
and you have circular dependencies. What you need is this:
define(function (require, exports, module) {
This is so that your module uses exports
to export its values and consequently RequireJS has an object that can be updated when the module has finished initialized.