Your point is very important. The key to requirejs is to insist that all code after requirejs is on the page will have absolutely no manual work to handle dependencies. To do this, you need to not use globals, and instead get clever about making your code more modular. Think of the requirejs cache as a dependency injection mechanism (or a bunch of global variables that also are smart enough to initialize each other) and do all of your work through it.
If you want to 'augment' an object like this, consider instead exporting files like 'object-small' (which just depends on the object) or 'object-with-fancy-decoration' (which depends on the object and decorator and returns the decorated object). This way require can handle load order for you.
Also, the use of absolute paths (like "./core") is, in my experience, an anti-pattern with require. By using naked paths (like 'core'), you can move files around (between baseDir and some other path specified in your require config) without things that depend on them having to know that they have moved.
Comments
Your point is very important. The key to requirejs is to insist that all code after requirejs is on the page will have absolutely no manual work to handle dependencies. To do this, you need to not use globals, and instead get clever about making your code more modular. Think of the requirejs cache as a dependency injection mechanism (or a bunch of global variables that also are smart enough to initialize each other) and do all of your work through it.
If you want to 'augment' an object like this, consider instead exporting files like 'object-small' (which just depends on the object) or 'object-with-fancy-decoration' (which depends on the object and decorator and returns the decorated object). This way require can handle load order for you.
Also, the use of absolute paths (like "./core") is, in my experience, an anti-pattern with require. By using naked paths (like 'core'), you can move files around (between baseDir and some other path specified in your require config) without things that depend on them having to know that they have moved.